| | 1 | '''Selecting the C++ language specification with GCC''' |
| | 2 | |
| | 3 | GCC supports finely granulated selection of the underlying C++ language specification With command line options. |
| | 4 | |
| | 5 | The command line option -std=c++98 selects language conformance with ISO/IEC 14882:1998, also known as C++98. |
| | 6 | |
| | 7 | The command line option -std=c++03 selects language conformance with ISO/IEC 14882:2003, also known as C++03. |
| | 8 | |
| | 9 | The command line option -std=c++11 selects language conformance with ISO/IEC 14882:2011, also known as C++11. |
| | 10 | |
| | 11 | In general, Boost libraries should be compatible with C++03 and use -std=c++03 accordingly. |
| | 12 | |
| | 13 | 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. |
| | 14 | |
| | 15 | GCC also has the similar language options -std=gnu++98, -std=gnu++03, -std=gnu++11, and -std=gnu++0x. |
| | 16 | These command line options activate certain GNU-specific language extensions. Please avoid using them because their use can lead to non-portability issues. |
| | 17 | |
| | 18 | 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. |
| | 19 | |
| | 20 | 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. |
| | 21 | |
| | 22 | In general, then, please use -std=c++03. |