Pages: 1 ... 3 4 [5] 6 7   Go Down
Author Topic: Ardunio C++ SUCKS!!!!  (Read 7616 times)
0 Members and 1 Guest are viewing this topic.
Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 50
Posts: 1767
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Cape Town South Africa
Online Online
Edison Member
*
Karma: 19
Posts: 1189
A newbie with loads of posts, and still so much to learn !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Είμαι βέβαιος Arduino είναι εξίσου εύκολο στην ελληνική γλώσσα  !
Logged

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

Cape Town South Africa
Online Online
Edison Member
*
Karma: 19
Posts: 1189
A newbie with loads of posts, and still so much to learn !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ...
Logged

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

Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 50
Posts: 1767
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Cape Town South Africa
Online Online
Edison Member
*
Karma: 19
Posts: 1189
A newbie with loads of posts, and still so much to learn !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Very interesting Michael,

and frightening,  I am so glad now that I never volounteered for a shuttle flight !
Logged

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

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 241
Posts: 24480
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Guys, I know this thread has gone way off-topic, but can you please not perpetuate the original title?
Logged

"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.

Cape Town South Africa
Online Online
Edison Member
*
Karma: 19
Posts: 1189
A newbie with loads of posts, and still so much to learn !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

OK
Logged

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

Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 50
Posts: 1767
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: August 04, 2012, 07:49:54 pm by MichaelMeissner » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
« Last Edit: August 16, 2012, 04:17:10 am by Nick Gammon » Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 diddle?)

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.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
« Last Edit: August 16, 2012, 01:30:39 am by gooby » Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: August 16, 2012, 01:55:15 am by Nick Gammon » Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Duane B
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: August 16, 2012, 01:51:07 am by gooby » Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 241
Posts: 24480
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

"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.

Pages: 1 ... 3 4 [5] 6 7   Go Up
Jump to: