Pages: 1 [2]   Go Down
Author Topic: switch { } need help  (Read 1040 times)
0 Members and 1 Guest are viewing this topic.
Ontario
Offline Offline
God Member
*****
Karma: 20
Posts: 835
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The fact that the arduino IDE does some preprocessing and that the IDE has lots of supplied optional arduino functions does not mean it's not truly C++, because it in fact calls the gcc C++ compiler

That same logic could be used to argue that FORTRAN is C because f2c exists.  The fact is that pre-processing CAN break things so that the language is not C or C++ any more.

In my opinion, the amount of pre-processing done by the Arduino front-end is a trifle heavy handed.  A few of the things it does are downright annoying -- like the way it misshandles things when there is a CPP directive it doesn't understand at the top of your file.  But I would grant that the resulting language still counts as C/C++ in this case.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11196
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That is pretty much just arguing systematics in my opinion. The fact that the arduino IDE does some preprocessing and that the IDE has lots of supplied optional arduino functions does not mean it's not truly C++, because it in fact calls the gcc C++ compiler, so by definition it is truly and only pure C++ has defined by the gcc compiler.

The differences between Wiring and C++ are small but IMO significant. The fact that what's compiled is not (quite) the same as your sketch matters when you're trying to understand why what looks like valid C++ doesn't compile, and would also matter if you took your experience with Wiring to a genuine C++ environment and expected it to work the same.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Left Coast, CA (USA)
Online Online
Brattain Member
*****
Karma: 332
Posts: 16567
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That is pretty much just arguing systematics in my opinion. The fact that the arduino IDE does some preprocessing and that the IDE has lots of supplied optional arduino functions does not mean it's not truly C++, because it in fact calls the gcc C++ compiler, so by definition it is truly and only pure C++ has defined by the gcc compiler.

The differences between Wiring and C++ are small but IMO significant. The fact that what's compiled is not (quite) the same as your sketch matters when you're trying to understand why what looks like valid C++ doesn't compile, and would also matter if you took your experience with Wiring to a genuine C++ environment and expected it to work the same.

I don't understand your point. Isn't Wiring just a C function. At least that is what I see when I look at the Arduino core source files.
Logged

Ontario
Offline Offline
God Member
*****
Karma: 20
Posts: 835
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Isn't Wiring just a C function. At least that is what I see when I look at the Arduino core source files.

"Wiring" is the name of the language/environment that is implemented for Arduino development.
https://en.wikipedia.org/wiki/Wiring_%28development_platform%29

In practice, it is just C with a dash of C++, some training wheels, and some bits and bobs whose purpose seems mainly to confuse folks who are used to C or C++, so I can understand your confusion.
Logged

Left Coast, CA (USA)
Online Online
Brattain Member
*****
Karma: 332
Posts: 16567
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Isn't Wiring just a C function. At least that is what I see when I look at the Arduino core source files.

"Wiring" is the name of the language/environment that is implemented for Arduino development.
https://en.wikipedia.org/wiki/Wiring_%28development_platform%29

In practice, it is just C with a dash of C++, some training wheels, and some bits and bobs whose purpose seems mainly to confuse folks who are used to C or C++, so I can understand your confusion.


Calling Wiring a programming language is just wrong. It may be a helpful way to explain to raw beginners how the IDE, their sketches, and the arduino hardware work together but it's an improper usage of 'programming language', at least in my opinion.

Lefty
Logged

UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11196
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't understand your point. Isn't Wiring just a C function. At least that is what I see when I look at the Arduino core source files.

The point is that the source is mucked about with by the IDE before it's compiled - I haven't looked at the details but I understand that some #include statements get added, and function declarations are autogenerated for you. I suppose that this subtle difference is why the files aren't saved with a .cpp extension. It's very very nearly C++ and most of the time the difference can be ignored, but occasionally the difference matters.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Pages: 1 [2]   Go Up
Jump to: