The IDE ships with a 4.3.2 GCC compiler that pre-dates support for C++ 11.
I imagine you could probably replace the compiler with a newer version. At one point on Fedora 17, I was using the Arduino IDE that was provided by the Fedora maintainers, instead of getting it from arduino.cc, and it used the newer 4.7.x compiler. Many recent linux distributions have newer embedded compilers (including AVR-GCC) that are based on 4.7.x.
If you are on Windows, you likely would need to build it from scratch. Speaking as a GCC global reviewer, it is not an easy task to build GCC from scratch.
If you do use a newer compiler, you might find it necessary to update some of the Arduino header files to cope with newer versions. If you do that, you might start with the teensy 3.0 modifications (from pjrc.com), since they provide a 4.7.2 arm compiler, and presumably have modified the common header files.
MichaelMeissner:
The IDE ships with a 4.3.2 GCC compiler that pre-dates support for C++ 11.
I imagine you could probably replace the compiler with a newer version. At one point on Fedora 17, I was using the Arduino IDE that was provided by the Fedora maintainers, instead of getting it from arduino.cc, and it used the newer 4.7.x compiler. Many recent linux distributions have newer embedded compilers (including AVR-GCC) that are based on 4.7.x.
If you are on Windows, you likely would need to build it from scratch. Speaking as a GCC global reviewer, it is not an easy task to build GCC from scratch.
If you do use a newer compiler, you might find it necessary to update some of the Arduino header files to cope with newer versions. If you do that, you might start with the teensy 3.0 modifications (from pjrc.com), since they provide a 4.7.2 arm compiler, and presumably have modified the common header files.
Thanks for the answer!
If I have some time, perhaps I do that... but yes, it WOULD be AWESOME if I had this, this would facilitate my code about 30%, since I develop advanced stuff with Arduino (ivanseidel (Ivan Seidel) · GitHub). Nice is too little for that... (at least for me, it would be awesome...)
I could do it, and apparently you could as well, but for the majority of poeple here it would be not be probable.
It's hard to know what side of the knowledge fence one should answer the questions here as for most people what is easy for one is impossible for another.
I could do it, and apparently you could as well, but for the majority of poeple here it would be not be probable.
It's hard to know what side of the knowledge fence one should answer the questions here as for most people what is easy for one is impossible for another.
With that in mind I stand by the answer.
I'm aware of the "avarege" of knowledge, but that doesen't justify answering "no" to a answer that is "yes"... Arduino Forum is not used only by "adventurers" that are seeking basic information, but by advanced users as well, that try to help others as well.
Just remember that, before answering something... As you can see, it's absolutely probable to do that, it might not be easy, but certainly possible...
And one thing "stupid" for some users, might be "awesome" for others... It's just a matter of standpoint... =]
Please, take my answer as positive, i'm not seeking argumentation here, just explaining my side
Note that C++11 is apparently an "ongoing" project in gcc: Page Redirection - GNU Project - some features are listed as requiring 4.8, and I'm not sure whether 4.8 is working on AVRs or not.
I compile with C++ 11 for many embbeded applications, without any problem (at all).
For AVR? Using gcc? Otherwise, it's a pretty meaningless statement.
"A newer version of the compiler" is a frequent request, since Arduino is stuck back at 4.3.2, which is quite old by now.
On the other hand, 4.4.x was broken, 4.5.x was broken, 4.6.0 was broken, 4.6.1 was broken... And 4.7 introduces a new mechanism for handling data in flash. (avr-gcc, avr-libc compiler and toolchain known bugs · Issue #1208 · arduino/Arduino · GitHub )
Perhaps the arduino team's reluctance to upgrade is somewhat understandable!
I don't see any problem in using the current compiler, it's just a matter of having more tools to work with. I thing Arduino will go to others versions when they become "thrustable". I was just asking about c++ 11 because it would save me a lot of work around on code, and would facilitate a little bit for me... =]
Ok, "yes, it's possible, as long as you only want C++11 features supported by current versions of avr-gcc. Arduino essentially includes a copy of WINAVR (for windows) or Crosspack (for Mac) (and ... something for linux.) Just replace the compiler, binutils, and avr-libc with newer versions that have the features you want (for example, using Atmel's AVR Toolchain for windows or linux, or a new Crosspack for Mac), and then correct any errors that this introduces into the Arduino core and non-core libraries that you are using. As usual, any features that require runtime support beyond mere compilation probably won't work."
westfw:
"A newer version of the compiler" is a frequent request, since Arduino is stuck back at 4.3.2, which is quite old by now.
On the other hand, 4.4.x was broken, 4.5.x was broken, 4.6.0 was broken, 4.6.1 was broken... And 4.7 introduces a new mechanism for handling data in flash. (avr-gcc, avr-libc compiler and toolchain known bugs · Issue #1208 · arduino/Arduino · GitHub )
Hopefully these bugs were reported to the GCC project. If they were not reported in the proper place, it shouldn't be a surprise that the bugs weren't fixed in the next release.
westfw:
Perhaps the arduino team's reluctance to upgrade is somewhat understandable!
I've been using the Atmel toolset for about three weeks (with Arduino 1.5) without any problems. The work has been on very small projects but covers several AVR processors. Consistently, the compiler / linker produces slightly smaller images. So far I'm pleased.
I can understand the Arduino team's reluctance but I can also understand the user community's frustration. The 3.4.2 toolset seems to be a good next step.
Hopefully these bugs were reported to the GCC project.
Well, eventually. IIRC, all of the bugs mentioned in that Arduino "issue" have trackable gcc issues as well (that was part of the point of creating it.)
It's a standard problem that if gcc releases a new version, but Arduino and crosspack keep using 4.3.2, and Atmel keeps using 4.5.3, and WinAVR is at 4.3.4, it'll be a while before anyone notices a bug that only affects C++ programs on AVRs with more than 64k of flash... It's exactly the sort of thing that scares teams away from upgrading the compiler...
This also brings up the fact that if anyone does upgrade their compiler, and finds "gratuitous" incompatibilities in the Arduino libraries that can be fixed without making files incompatible with the current compiler, be sure to submit what you found, and the fixes, as Arduino "issues." They can be accepted more easily that the new compiler, and even if they aren't accepted, having them documented in a common place is a good thing.