Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When will Gnu C++ support C++11 without explicitly asking for it?

People also ask

When did GCC support C ++ 11?

According to cppreference, full support of c++11 came with gcc 4.8.

Does GCC 11 support C++17?

C++17 Support in GCCThis mode is the default in GCC 11; it can be explicitly selected with the -std=c++17 command-line flag, or -std=gnu++17 to enable GNU extensions as well.

How do I know if G ++ supports C ++ 11?

To see if your compiler has C++11 support, run it with just the --version option to get a print out of the version number. Do this for whichever compiler(s) you wish to use with Rosetta. Acceptable versions: GCC/g++: Version 4.8 or later.

What version of C does GCC support?

GCC implements the majority of C++98 ( export is a notable exception) and most of the changes in C++03.


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.


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.

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.