|
| 1 | + -std= |
| 2 | + Determine the language standard. This option is currently only supported when compiling C or C++. |
| 3 | + |
| 4 | + The compiler can accept several base standards, such as c90 or c++98, and GNU dialects of those standards, such as gnu90 or gnu++98. When a base |
| 5 | + standard is specified, the compiler accepts all programs following that standard plus those using GNU extensions that do not contradict it. For |
| 6 | + example, -std=c90 turns off certain features of GCC that are incompatible with ISO C90, such as the "asm" and "typeof" keywords, but not other |
| 7 | + GNU extensions that do not have a meaning in ISO C90, such as omitting the middle term of a "?:" expression. On the other hand, when a GNU |
| 8 | + dialect of a standard is specified, all features supported by the compiler are enabled, even when those features change the meaning of the base |
| 9 | + standard. As a result, some strict-conforming programs may be rejected. The particular standard is used by -Wpedantic to identify which |
| 10 | + features are GNU extensions given that version of the standard. For example -std=gnu90 -Wpedantic warns about C++ style // comments, while |
| 11 | + -std=gnu99 -Wpedantic does not. |
| 12 | + |
| 13 | + A value for this option must be provided; possible values are |
| 14 | + |
| 15 | + c90 |
| 16 | + c89 |
| 17 | + iso9899:1990 |
| 18 | + Support all ISO C90 programs (certain GNU extensions that conflict with ISO C90 are disabled). Same as -ansi for C code. |
| 19 | + |
| 20 | + iso9899:199409 |
| 21 | + ISO C90 as modified in amendment 1. |
| 22 | + |
| 23 | + c99 |
| 24 | + c9x |
| 25 | + iso9899:1999 |
| 26 | + iso9899:199x |
| 27 | + ISO C99. This standard is substantially completely supported, modulo bugs and floating-point issues (mainly but not entirely relating to |
| 28 | + optional C99 features from Annexes F and G). See <http://gcc.gnu.org/c99status.html> for more information. The names c9x and iso9899:199x |
| 29 | + are deprecated. |
| 30 | + |
| 31 | + c11 |
| 32 | + c1x |
| 33 | + iso9899:2011 |
| 34 | + ISO C11, the 2011 revision of the ISO C standard. This standard is substantially completely supported, modulo bugs, floating-point issues |
| 35 | + (mainly but not entirely relating to optional C11 features from Annexes F and G) and the optional Annexes K (Bounds-checking interfaces) and |
| 36 | + L (Analyzability). The name c1x is deprecated. |
| 37 | + |
| 38 | + c17 |
| 39 | + c18 |
| 40 | + iso9899:2017 |
| 41 | + iso9899:2018 |
| 42 | + ISO C17, the 2017 revision of the ISO C standard (expected to be published in 2018). This standard is same as C11 except for corrections of |
| 43 | + defects (all of which are also applied with -std=c11) and a new value of "__STDC_VERSION__", and so is supported to the same extent as C11. |
| 44 | + |
| 45 | + gnu90 |
| 46 | + gnu89 |
| 47 | + GNU dialect of ISO C90 (including some C99 features). |
| 48 | + |
| 49 | + gnu99 |
| 50 | + gnu9x |
| 51 | + GNU dialect of ISO C99. The name gnu9x is deprecated. |
| 52 | + |
| 53 | + gnu11 |
| 54 | + gnu1x |
| 55 | + GNU dialect of ISO C11. The name gnu1x is deprecated. |
| 56 | + |
| 57 | + gnu17 |
| 58 | + gnu18 |
| 59 | + GNU dialect of ISO C17. This is the default for C code. |
| 60 | + |
| 61 | + c++98 |
| 62 | + c++03 |
| 63 | + The 1998 ISO C++ standard plus the 2003 technical corrigendum and some additional defect reports. Same as -ansi for C++ code. |
| 64 | + |
| 65 | + gnu++98 |
| 66 | + gnu++03 |
| 67 | + GNU dialect of -std=c++98. |
| 68 | + |
| 69 | + c++11 |
| 70 | + c++0x |
| 71 | + The 2011 ISO C++ standard plus amendments. The name c++0x is deprecated. |
| 72 | + |
| 73 | + gnu++11 |
| 74 | + gnu++0x |
| 75 | + GNU dialect of -std=c++11. The name gnu++0x is deprecated. |
| 76 | + |
| 77 | + c++14 |
| 78 | + c++1y |
| 79 | + The 2014 ISO C++ standard plus amendments. The name c++1y is deprecated. |
| 80 | + |
| 81 | + gnu++14 |
| 82 | + gnu++1y |
| 83 | + GNU dialect of -std=c++14. This is the default for C++ code. The name gnu++1y is deprecated. |
| 84 | + |
| 85 | + c++17 |
| 86 | + c++1z |
| 87 | + The 2017 ISO C++ standard plus amendments. The name c++1z is deprecated. |
| 88 | + gnu++17 |
| 89 | + gnu++1z |
| 90 | + GNU dialect of -std=c++17. The name gnu++1z is deprecated. |
| 91 | + |
| 92 | + c++2a |
| 93 | + The next revision of the ISO C++ standard, tentatively planned for 2020. Support is highly experimental, and will almost certainly change in |
| 94 | + incompatible ways in future releases. |
| 95 | + |
| 96 | + gnu++2a |
| 97 | + GNU dialect of -std=c++2a. Support is highly experimental, and will almost certainly change in incompatible ways in future releases. |
| 98 | + |
| 99 | + |
0 commit comments