When will Gnu C++ support C++11 without explicitly asking for it?
Solution 1:
GCC 6.0: https://gcc.gnu.org/gcc-6/changes.html
The default mode for C++ is now
-std=gnu++14
instead of-std=gnu++98
.
Solution 2:
The closest I think to an answer I can get is from the info gcc
command:
A revised ISO C++ standard was published in 2011 as ISO/IEC 14882:2011, and is referred to as C++11; before its publication it was commonly referred to as C++0x. C++11 contains several changes to the C++ language, most of which have been implemented in an experimental C++11 mode in GCC. For information regarding the C++11 features available in the experimental C++11 mode, see http://gcc.gnu.org/projects/cxx0x.html. To select this standard in GCC, use the option '-std=c++11'; to obtain all the diagnostics required by the standard, you should also specify '-pedantic' (or '-pedantic-errors' if you want them to be errors rather than warnings).
The http://gcc.gnu.org/projects/cxx0x.html page says:
Important: GCC's support for C++11 is still experimental. Some features were implemented based on early proposals, and no attempt will be made to maintain backward compatibility when they are updated to match the final C++11 standard.
The libstdc++ page also shows that it is incomplete. (I don't even think regex
is implemented yet.)
Steve Jessop's answer basically says the same thing in the last paragraph, but to quote the first part of his answer:
C++11 has been standard for a couple of years, but a compiler isn't going to switch its default mode to C++11 until:
- At an absolute minimum, C++11 support is complete in that compiler and the libraries it uses. And also stable, if the compiler writer has any concern at all for reliability.
- Preferably, a major version number increase in the compiler, since C++11 is not fully backward-compatible to C++03.
- Ideally, on a well-known schedule so that users can prepare for the change.
Solution 3:
UPDATE: The original answer has become outdated in the past 28 months. According to nobar's answer, GCC 6.1 supports C++14 with GNU extensions by default. GCC 6.1 was released on April 27, 2016. I am quite surprised but very happy to see such a fast adoption of the new standard!
As for the rest of the original answer, I still see value in keeping that part that answers how to make certain flags "default". So I kept it below.
Is there a plan when I just can say [...]
You could define default flags in a Makefile and then all you have to say is make
.
The accepted answer to How do I enable C++11 in gcc? should get you started (or some makefile tutorial).
Another advice that seems to pop up often here at Stackoverflow is to add a bash alias alias g++="g++ --std=c++0x"
, see here how. However, I personally wouldn't do this though, it can lead to unpleasant surprises; there has been breaking changes with C++11. I would create my own makefile and type simply make
.