wiki:Guidelines/GCCBoost

Selecting the C++ language specification with GCC

GCC supports finely granulated selection of the underlying C++ language specification With command line options.

The command line option -std=c++98 selects language conformance with ISO/IEC 14882:1998, also known as C++98.

The command line option -std=c++03 selects language conformance with ISO/IEC 14882:2003, also known as C++03.

The command line option -std=c++11 selects language conformance with ISO/IEC 14882:2011, also known as C++11.

In general, Boost libraries should be compatible with C++03 and use -std=c++03 accordingly.

Important: Please avoid using -std=c++11, -std=gnu++11, and -std=gnu++0x. These command line arguments activate GCC's experimental support for C++11. There is not yet a consensus on using C++11 in Boost libraries off-the-rack.

GCC also has the similar language options -std=gnu++98, -std=gnu++03, -std=gnu++11, and -std=gnu++0x. These command line options activate certain GNU-specific language extensions. Please avoid using them because their use can lead to non-portability issues.

The GCC command line option -std=c++0x was an interim solution used for preliminary support support for C++11 features before these were published by ISO. As of GCC 4.7, the command line option -std=c++0x has been replaced with -std=c++11. If possible, preferentially use -std=C++11 instead of -std=c++0x when testing for C++11 compatibility. This rational for this is that -std=c++0x can easily be confused with, for example, -std=c++03.

Do note, however, that Boost libraries should not yet rely on C++11 via the -std=c++11 switch for their build and/or usage.

In general, then, please use -std=c++03.

Last modified 10 years ago Last modified on Mar 18, 2013, 10:20:29 AM
Note: See TracWiki for help on using the wiki.