Macros related to language levels

The following macros except C++ only__cplusplus, __STDC__C++ only ends, and C only__STDC_VERSION__C only ends are predefined to a value of 1 by a specific language level, represented by a suboption of the -std compiler option, or any invocation or pragma that implies that suboption.

If the suboption enabling the feature is not in effect, the macro is undefined. For descriptions of the features related to these macros, see the C and C++ language standards.

Table 1. Predefined macros for language features
Predefined macro name Description Predefined when the following language level or compiler option is in effect
C++ only__cplusplus The numeric value that indicates the supported language standard as defined by that specific standard. Always predefined. The format is yyyymmL. (For example, the format is 201103L for C++11.)
__STDC__ Indicates that the compiler conforms to the ANSI/ISO C standard.

C only Predefined to 1 if ANSI/ISO C standard conformance is in effect.

C++ only Explicitly defined to 0.

__STDC_HOSTED__ Indicates that the implementation is a hosted implementation of the ANSI/ISO C standard. (That is, the hosted environment has all the facilities of the standard C available).

Predefined to 1 by default

Predefined to 0 if -ffreestanding is specified.

C11__STDC_NO_ATOMICS__ Indicates that the implementation does not have the full support of the atomics feature. -std=c11 | -std=gnu11
C11__STDC_NO_THREADS__ Indicates that the implementation does not have the full support of the threads feature. -std=c11 | -std=gnu11
C only __STDC_VERSION__ Indicates the version of ANSI/ISO C standard which the compiler conforms to. C onlyAlways predefined. The format is yyyymmL. (For example, the format is 199901L for C99.)