Il 27/09/2016 23:58, Jim Leonard ha scritto:
> Honestly I wish it would either work well or be gotten rid of completely.
>
> The auto generation thing has been problematic for me in the past when I have functions that are passed structs/classes that I've defined as it will generate a declaration for me even when it's not needed and place the declaration above where I've defined my struct/class.
Actually, the Arduino preprocessor handles 99.9% of the cases (the
millions of sketches build everyday with the Arduino IDE).
From time to time someone comes out with an example, of very convoluted
C++, that fails to compile because the Arduino preprocessor fails to
detect a prototype. This error is generally workaround by manually
declaring the "missed" prototype (as in this case).
More rarely someone comes out with an example where the failure of the
preprocessor cannot be worked-around.
I think that, if we try hard, we can always find a C++ example, complex
enough, that is not handled correctly by the preprocessor so, in a way,
the preprocessor will never be "perfect".
As I stated in my other post, if you really want to use all the advanced
features of C++ you can always create files with .cpp extensions that
are not preprocessed.