Go Down

Topic: Ardunio C++ SUCKS!!!! (Read 10 times) previous topic - next topic

MichaelMeissner


Are you sure about this? I thought NASA was writing code in the ADA language?
Best regards
Jantje

They are using ADA now.  In the early days they were using HAL/S (and presumably other languages).  One of my previous co-workers used to work at Intermetrics on the HAL/S compiler.  http://en.wikipedia.org/wiki/HAL/S.

Boffin1

????? ??????? Arduino ????? ?????? ?????? ???? ???????? ??????  !
With my mobile phone I can call people and talk to them -  how smart can you get ?

Boffin1

I was working at a NASA tracking station in the UK when I did a ( 2 days )familiarisation  course  in Fortran ( 1968  )
I assume we were using it for satellite predictions ...
With my mobile phone I can call people and talk to them -  how smart can you get ?

MichaelMeissner

Since we have wandered into talking about the space shuttles (RIP), I probably should mention my brief encounter with space shuttle software.  Feel free to skip this if you don't want the meandering of how things were done in the old days.

When I started out many years ago, I went to work at Data General, which was a mini-computer company competing with DEC (Digital Equipment Corporation, both RIP as well).  The first compiler that I worked on was DG/L (Data General's Language which was based on Algol-60).  Looking back, it was a rather horrid language, that was less structured than C (you had no struct/union/class constructs, instead you created structures via pointer + constant with a typed indirection, which was great fun as we tried to transition from 16-bit programs to 32-bit, and you had to go through and change all of the constants when the int and pointer sizes changed).

After about 6 months on the job, the support organization gets a call from Rockwell saying essentially Data General is holding up the initial launch of the Space Shuttle and they are going to start suing us for millions of dollars.  And all of us working on parts of the system were made fixing the problem our top priority.  What was happening is they were using a Data General Nova that was sitting under the rocket pad, busily sending out loads of telemetry data to another Nova until the original unit gets burned up by the launch.

So in DG/L land, I'm told to go over the code to make sure there were no places the compiler generated incorrect code.  I found millions of places where the Nova code could be improved, but no place where it actually was wrong.  Note, at this time the Nova was the old processor, and the Eclipse was the new processor, and we in DG/L were primarily focused on Eclipse support, so we never got around to improving the Nova code.  DG had two operating systems at the time, RDOS (a real time operating system) and AOS (a time shared operating system).  DG/L was one of the few languages that allowed you to code on AOS and download to RDOS (much like the Arduino, where you run the compiler on Windows, Linux, or Mac, and download it to the board).

It turns out the communications processor was using RDOS, and in fact a package (X.25) that Data General had withdrawn from the market but would happily sell you the last known version with the proviso that under no circumstance would there ever be a new revision (gee, what a great system to use for a mission critical application but what likely happened is when it first started it was supported, but with development contracts being so long, that it had passed out of the window of support).  Fortunately this occurred before DG's first layoff, and eventually we found somebody who had worked on the project and the code.

The eventual answer was the X.25 code defined a static buffer to use for the communication setup.  It defined a label in one module as the start of the buffer, and a second label in the second module as the end of the buffer.  The RDOS linker that it was generated for, would put the objects sequentially in memory, while the AOS cross linker reordered the modules.  The code was taking the two labels and subtracting them to get the length.  Since the AOS linker put them in reverse, it meant it would use all of memory except for the actual buffer for communication, and wipe out the program text along with all other variables.  Fortunately in Arduino land, we are protected from this, as it is a so-called Harvard architecture where the program space is completely different from the data space.

:smiley-sweat:

Boffin1

Very interesting Michael,

and frightening,  I am so glad now that I never volounteered for a shuttle flight !
With my mobile phone I can call people and talk to them -  how smart can you get ?

AWOL

Guys, I know this thread has gone way off-topic, but can you please not perpetuate the original title?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Boffin1

With my mobile phone I can call people and talk to them -  how smart can you get ?

MichaelMeissner

#67
Aug 05, 2012, 01:17 am Last Edit: Aug 05, 2012, 02:49 am by MichaelMeissner Reason: 1
Fair enough, though I will note, that if you go into the forum, you will see the original title, even if I change the subject like I do on this post.

gooby

#68
Aug 16, 2012, 07:39 am Last Edit: Aug 16, 2012, 11:17 am by Nick Gammon Reason: 1
Well um yeah you can definitely write subroutines in C++...

But, incidentally, I agree.

C++ is a godawful programming language. I understand the need for economy, which is just fine but could it have been Objective-C (genuine superset of C, Smalltalk-based object system, simpler syntax and semantics)?

At any rate C++ as it appears in Arduino appears to be considerably stripped down from the 1,338 page ISO standard. (Seriously what the ----?)

Moderator edit: Removed profanity. (Nick Gammon)

Osgeld

Quote

C++ is a godawful programming language.


it can be if your trying to do something simple .. course you can write it in plain ole C and cut that down quite a bit
Quote

At any rate C++ as it appears in Arduino appears to be considerably stripped down from the 1,338 page ISO standard. (Seriously what the fuck?)


its not cut down, its just behind a library of noobie friendly libraries .. nothing is really stopping you from doing hard core C or C++ or ASM, shit, toggle registers with a grounded needle for all we care, its not going to help soccer mom making a blinky Halloween costume.
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

gooby

#70
Aug 16, 2012, 08:22 am Last Edit: Aug 16, 2012, 08:30 am by gooby Reason: 1

Quote

C++ is a godawful programming language.


it can be if your trying to do something simple .. course you can write it in plain ole C and cut that down quite a bit


I'm not talking about the level of abstraction or whatever. Depending on what you mean by "simple" (it's ambiguous) I would prefer either OCaml or Python (ideally). Python is my everyday language; OCaml I use when performance counts but I want to keep GC and other powerful features, like partial application (not easy in most other languages!).

But C++ as a language is disgustingly huge.

its not cut down


Trust me. Here's the first edition of the standard (it's substantially larger now) :

http://www-d0.fnal.gov/~dladams/cxx_standard.pdf

Look at all that stuff. Eugh! Even if you consider a lot of it to be implicit in this:

http://arduino.cc/en/Reference/HomePage

It still easily outstrips what Arduino implements. And other programming languages do essentially the same things in a far smaller framework. Compare the disaster that is C++ polymorphism to how ML and co. do it. Smaller, thus easier to understand and type-safe.

nothing is really stopping you from doing hard core C or C++ or ASM, shit, toggle registers with a grounded needle for all we care


That's not what I'm talking about. I use Python, after all. I'm not about making things needlessly hard. I use Python whenever I can because the language and the milieu that grew up around it tends to make everything so easy. My point is that C++ is heinously baroque. Rococo even. It's even worse than Common Lisp.

Design-wise, my favorite is Smalltalk. Smalltalk variants have a lot of drawbacks to be absolutely clear. But look at how much you can get done with so few constructs. Scheme is comparable, too, though I personally hate macros (not that you're bound to write your own). But the bottom line is simplicity: that's where C++ got it wrong. That's also where Objective-C gets it right. Not that I'm a huge Apple fan but the de facto standard description of Obj-C and important ancillaries is over there on their website.

http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html

See how much smaller that is?

Nick Gammon

#71
Aug 16, 2012, 08:37 am Last Edit: Aug 16, 2012, 08:55 am by Nick Gammon Reason: 1

See how much smaller that is?


You're jesting, I presume. That is just an index page.

Quote
But C++ as a language is disgustingly huge.


What do you mean exactly? The compiled code? The source code needed to achieve something useful? The documentation?

Quote
It's even worse than Common Lisp.


I eagerly await an example of writing, say, an interrupt service routine in Lisp.
http://www.gammon.com.au/electronics

DuaneB

Mods might want to clean up the language in one or two of these posts

Duane B
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

gooby

#73
Aug 16, 2012, 08:48 am Last Edit: Aug 16, 2012, 08:51 am by gooby Reason: 1

You're jesting, I presume. That is just an index page.


Yeah, OK. Browse around a little. Would that add up to the 700+ pages that the first C++ standard had? (To say nothing of the current 1100+?)

What do you mean exactly? The compiled code? The source code needed to achieve something useful? The documentation?


Any combination thereof (templates in particular have a way of inflating code size), though I had the standard as such in mind. What you need to know to understand the language fully.

Of course when you're running closer to the hardware the amount of code generally increases, so that's not all C++'s fault as such. I should note however that OCaml is pretty high-level, compiles to machine code, and can compare favorably to competitors in that arena esp. if you take special care in features you use.

I eagerly await an example of writing, say, an interrupt service routine in Lisp.


Interrupt handlers? Sure Lisp dialects have them. Again, not that I'm a huge fan of Common Lisp ... I have heard tell that it's used in time-critical algorithmic trading applications though.

AWOL

Quote
Mods might want to clean up the language in one or two of these posts

You mean, like, actually read all of them again?
No way!
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up