Go Down

Topic: switch { } need help (Read 1 time) previous topic - next topic

gardner


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.

PeterH


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 only provide help via the forum - please do not contact me for private consultancy.

retrolefty



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.

gardner


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.

retrolefty



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

PeterH


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.
I only provide help via the forum - please do not contact me for private consultancy.

Go Up