Macros related to language levels

The following macros can be tested for C99 features, features related to GNU C or C++, and other IBM language extensions. All of these 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 LANGLVL 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.

Table 1. Predefined macros for language features
Predefined macro name Description Predefined when the following language level is in effect
C only __ANSI__ Indicates that only language constructs that support the ISO C89 Standard are allowed. ansi | stdc89 | stdc99
C++ only __BOOL__ Indicates that the bool keyword is accepted. Always defined except when NOKEYWORD(bool) is in effect.
C only __C99_BOOL Indicates support for the _Bool data type. extc1x | stdc99 | extc99 | extc89 | extended
C++ only __C99_COMPLEX Indicates that the support for C99 complex types is enabled or that the C99 complex header should be included. extc1x | stdc99 | extc99 | extc89 | extended
C only __C99_CPLUSCMT Indicates support for C++ style comments

extc1x | stdc99 | extc99 | stdc89 | extc89 | extended (also SSCOM)

__C99_COMPOUND_LITERAL Indicates support for compound literals. extc1x | stdc99 | extc99 | extc89 | extended
C only __C99_DESIGNATED_INITIALIZER Indicates support for designated initialization. extc1x | stdc99 | extc99 | extc89 | extended
C only __C99_DUP_TYPE_QUALIFIER Indicates support for duplicated type qualifiers. extc1x | stdc99 | extc99 | extc89 | extended
C only __C99_EMPTY_MACRO_ARGUMENTS Indicates support for empty macro arguments. extc1x | stdc99 | extc99 | extc89 | extended
C only __C99_FLEXIBLE_ARRAY_MEMBER Indicates support for flexible array members. extc1x | stdc99 | extc99 | extc89 | extended
__C99__FUNC__ Indicates support for the __func__ predefined identifier.

C only extc1x | stdc99 | extc99 | extc89 | extended

C++ only extended | extended0x |c99__func__

__C99_HEX_FLOAT_CONST Indicates support for hexadecimal floating constants. extc1x | stdc99 | extc99 | extc89 | extended
C only __C99_INLINE Indicates support for the inline function specifier. extc1x | stdc99 | extc99
__C99_LLONG Indicates support for C99-style long long data types and literals. extc1x | stdc99 | extc99

C++ only extended0x | c99longlong

__C99_MACRO_WITH_VA_ARGS Indicates support for function-like macros with variable arguments.

extc1x | stdc99 | extc99 | extc89 | extended

C++ only extended

__C99_MAX_LINE_NUMBER Indicates that the maximum line number is 2147483647.

extc1x | stdc99 | extc99 | extc89 | extended

C++ only extended0x | c99preprocessor

C only __C99_MIXED_DECL_AND_CODE Indicates support for mixed declaration and code. extc1x | stdc99 | extc99 | extc89 | extended
__C99_MIXED_STRING_CONCAT Indicates support for concatenation of wide string and non-wide string literals.

extc1x | stdc99 | extc99 | extc89 | extended

C++ only extended0x | c99preprocessor

C only __C99_NON_LVALUE_ARRAY_SUB Indicates support for non-lvalue subscripts for arrays. extc1x | stdc99 | extc99 | extc89 | extended
C only__C99_NON_CONST_AGGR_INITIALIZER Indicates support for non-constant aggregate initializers. extc1x | stdc99 | extc99 | extc89 | extended
__C99_PRAGMA_OPERATOR Indicates support for the _Pragma operator.

extc1x | stdc99 | extc99 | extc89 | extended

C++ only extended

C only __C99_REQUIRE_FUNC_DECL Indicates that implicit function declaration is not supported. stdc99
C only __C99_RESTRICT Indicates support for the C99 restrict qualifier.

extc1x | stdc99 | extc99

C only __C99_STATIC_ARRAY_SIZE Indicates support for the static keyword in array parameters to functions. extc1x | stdc99 | extc99 | extc89 | extended
C only __C99_STD_PRAGMAS Indicates support for standard pragmas. extc1x | stdc99 | extc99 | extc89 | extended
C only __C99_TGMATH Indicates support for type-generic macros in tgmath.h extc1x | stdc99 | extc99 | extc89 | extended
__C99_UCN Indicates support for universal character names. C only extc1x | stdc99 | extc99 | extc89 | extended
C only __C99_VAR_LEN_ARRAY Indicates support for variable length arrays. extc1x | stdc99 | extc99 | extc89 | extended
C++ only __C99_VARIABLE_LENGTH_ARRAY Indicates support for variable length arrays. extended | extended0x | c99vla
C only __COMMONC__ Indicates that language constructs defined by XPG are allowed. commonc
C++ only __COMPATMATH__ Indicates that the newer C++ function declarations are not to be introduced by the math.h header file. oldmath
_EXT Used in features.h to control the availability of extensions to the general ISO run-time libraries. LIBEXT, or any LANGLVL suboption that implies it. (See the description of the LANGLVL option in the z/OS XL C/C++ User's Guide for a list of suboptions that imply LIBEXT.)
__EXTENDED__

Indicates that language extensions are supported.

extended
__IBM_COMPUTED_GOTO Indicates support for computed goto statements.

C only extc1x | extc99 | extc89 | extended

C++ only extended | extended0x | gnu_computedgoto

__IBM_INCLUDE_NEXT Indicates support for the #include_next preprocessing directive. Always defined.
__IBM_LABEL_VALUE Indicates support for labels as values.

C only extc1x | extc99 | extc89 | extended

C++ only extended | extended0x |gnu_labelvalue

__IBM__TYPEOF__

Indicates support for the __typeof__ keyword.

C only Always defined

C++ only extended | extended0x

__IBMC_COMPLEX_INIT Indicates support for the macro based initialization of complex types: float _Complex, double _Complex, and long double _Complex. extc1x
__IBMC_GENERIC Indicates support for the generic selection feature.

C onlyextc89 | extc99 | extended | extc1x

__IBMC_NORETURN Indicates support for the _Noreturn function specifier.

C onlyextc89 | extc99 | extended | extc1x

C++ only extended | extended0x | c1xnoreturn

C11 __IBMC_STATIC_ASSERT Indicates support for the static assertions feature. extc89 | extc99 | extended | extc1x
C++11 __IBMCPP_AUTO_TYPEDEDUCTION Indicates support for the auto type deduction feature. extended0x | autotypededuction
C++11 __IBMCPP_C99_LONG_LONG Indicates support for the C99 long long feature. extended0x | c99longlong
C++11 __IBMCPP_C99_PREPROCESSOR Indicates support for the C99 preprocessor features adopted in the C++11 standard. extended0x | c99preprocessor
C++ only__IBMCPP_COMPLEX_INIT Indicates support for the initialization of complex types: float _Complex, double _Complex, and long double _Complex. extended
C++11 __IBMCPP_CONSTEXPR Indicates support for the generalized constant expressions feature. extended0x | constexpr
C++11 __IBMCPP_DECLTYPE Indicates support for the decltype feature. extended0x | decltype
C++11 __IBMCPP_DEFAULTED_AND_DELETED_FUNCTIONS Indicates support for the defaulted and deleted functions feature. extended0x | defaultanddelete
C++11 __IBMCPP_DELEGATING_CTORS Indicates support for the delegating constructors feature. extended0x | delegatingctors
C++11 __IBMCPP_EXPLICIT_CONVERSION_OPERATORS Indicates support for the explicit conversion operators feature. extended0x | explicitconversionoperators
C++11 __IBMCPP_EXTENDED_FRIEND Indicates support for the extended friend declarations feature. extended0x | extendedfriend
C++11 __IBMCPP_EXTERN_TEMPLATE Indicates support for the explicit instantiation declarations feature. extended | extended0x | externtemplate
C++11 __IBMCPP_INLINE_NAMESPACE Indicates support for the inline namespace definitions feature. extended0x | inlinenamespace
C++11 __IBMCPP_REFERENCE_COLLAPSING Indicates support for the reference collapsing feature. extended0x | referencecollapsing
C++11__IBMCPP_RIGHT_ANGLE_BRACKET Indicates support for the right angle bracket feature. extended0x | rightanglebracket
C++11 __IBMCPP_RVALUE_REFERENCES Indicates support for the rvalue references feature. extended0x | rvaluereferences
C++11 __IBMCPP_SCOPED_ENUM Indicates support for the scoped enumeration feature. extended0x | scopedenum
C++11 __IBMCPP_STATIC_ASSERT Indicates support for the static assertions feature.

C++ only extended0x | static_assert

C++11__IBMCPP_VARIADIC_TEMPLATES Indicates support for the variadic templates feature. extended0x | variadic[templates]
_LONG_LONG Indicates support for long long data types.

C only extc1x | stdc99 | extc99 | | stdc89 | extc89 | extended | longlong

C++ only extended0x | c99longlong | extended | longlong

_MI_BUILTIN Indicates that the machine instruction built-in functions are available. LIBEXT, or any LANGLVL suboption that implies it. (See the description of the LANGLVL option in the z/OS XL C/C++ User's Guide for a list of suboptions that imply LIBEXT.)
C only __RESTRICT__ Indicates that the __restrict__ or __restrict keywords are supported. Predefined at all language levels.
C only __SAA__ Indicates that only language constructs that support the most recent level of SAA C standards are allowed. saa
C only __SAA_L2__ Indicates that only language constructs that conform to SAA Level 2 C standards are allowed. saal2