When does Gnu C ++ support C ++ 11 without an explicit request?

Currently with g ++ - 4.8.1 you need to compile the file in C ++ 11 mode via

g++ -std=c++11 -o prog.x prog.cpp 

Is there a plan when I can just say

 g++ -o prog.x prog.cpp 

to compile prog.cpp ?

Maybe prog.cpp has

  • #include <regex>
  • thread_local
  • class Widget { int member = 5; }
  • MyType operator"" myt(const char*, sze_t);
  • etc.
+45
c ++ gcc c ++ 11
Jan 19 '14 at 19:20
source share
4 answers

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 .

+27
Oct 20 '15 at 14:15
source share

The closest I think to the answer I can get is the info gcc command:

The revised ISO C ++ standard was published in 2011 as ISO / IEC 14882: 2011, and is called C ++ 11; before its publication, commonly called C ++ 0x. C ++ 11 contains several changes to the C ++ Language, most of which were implemented in the experimental C ++ 11 in GCC. For information on the features of C ++ 11 available in experimental C ++ 11, see http://gcc.gnu.org/projects/cxx0x.html . To select this standard in GCC, use the option '-std = C ++ 11'; to get all the diagnostics required by the standard, you should also specify '-special' (or '-pedantic-errors' if you want them to be errors, not warnings).

The page http://gcc.gnu.org/projects/cxx0x.html says:

Important: GCC support for C ++ 11 is still experimental. Some features were implemented based on early suggestions, and no attempt will be made to provide backward compatibility when upgrading them to comply with the final C ++ 11 standard.

The libstdc ++ page also shows that it is incomplete. (I don't even think regex 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 was standard for a couple of years, but the compiler did not switch the default mode to C ++ 11 until:

  • With an absolute minimum, C ++ 11 support is complete in this compiler and the libraries it uses. And also stable if the compiler writer has any concerns about reliability.
  • It is advisable that the number of major versions increase in the compiler, since C ++ 11 is not fully compatible with C ++ 03.
  • Ideally, in a well-known schedule, so that users can prepare for changes.
+19
Jan 19 '14 at 19:44
source share

UPDATE: The original answer has been deprecated in the last 28 months. According to the noble answer , GCC 6.1 supports C ++ 14 with default GNU extensions. GCC 6.1 was released on April 27, 2016. I am very surprised, but very glad to see such a quick adoption of the new standard!

As for the rest of the original answer, I still see the value in that this part answers how to make certain "default" flags. So I saved it below.




Is there a plan when I can say [...]

You can define default flags in the Makefile, and then all you have to say is make .

Accepted answer How to enable C ++ 11 in gcc? you should start (or a few makefile tutorial ).

Another tip that often appears here in Stackoverflow is to add the alias bash alias g++="g++ --std=c++0x" , see here . However, I personally did not do this, but this can lead to unpleasant surprises; there have been changes in C ++ 11. I would create my own makefile and type simply make .




+13
Jan 19 '14 at 22:51
source share

It seems that GCC 5.0 will have gnu11 (C ++ 11 AFAIK dialect) by default with improvements in C ++ 11 as shared in changes. See https://gcc.gnu.org/gcc-5/changes.html . It seems he will have support and C ++ 14.

One of the most interesting statements regarding the bugzilla script that was shared using @ marc-glisse seems to be outside the table, see https://gcc.gnu.org/gcc-5/criteria.html for details: -

All the regressions discovered in Bugzilla were analyzed, and all of them are considered either unlikely for most users, or have minimal impact on the affected users. For example, a typographical error in diagnosis may be relatively common, but also have minimal impact on users.

In general, regressions in which the compiler generates the wrong code or refuses to make a valid program will be considered serious enough to block the release if there are no significant mitigating factors. - GCC Release Criteria Page

The timeline gives some idea of ​​when and if this happens https://gcc.gnu.org/develop.html#timeline

So, we hope that by 2015 we will see a new version of gcc with C ++ 11 support. When GNU / Linux distributions are distributed and what they need to do for software built using C ++ 11 is one more question,

-3
Dec 14 '14 at 21:28
source share



All Articles