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 (-qlanglvl) compiler option, or any invocation or pragma that implies that suboption. If the suboption enabling the feature is not in effect, then the macro is undefined. For descriptions of the features related to these macros, see the XL C/C++ Language Reference and the C and C++ language standards.

Table 1. Predefined macros for language features
Predefined macro name Description Predefined when the following language level is in effect
C++ only __BOOL__ Indicates that the bool keyword is accepted. Always defined.
C++ only__cplusplus The numeric value that indicates the supported language standard as defined by that specific standard. The format is yyyymmL. (For example, the format is 199901L for C99.)
C++ only__IBMCPP_COMPLEX_INIT Indicates support for the initialization of complex types: float _Complex, double _Complex, and long double _Complex. extended | extended0x
__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).

C onlystdc11 | extc1x | stdc99 | extc99

C++ only extended0x| extended1y

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


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us