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 are predefined to a value of 1 by a specific language level, represented by a suboption of the -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.

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 except when -qnokeyword=bool is in effect.
C only __C99_BOOL Indicates support for the _Bool data type. stdc99 | extc99 | extc89 | extended
C only __C99_COMPLEX Indicates support for complex data types. stdc99 | extc99 | extc89 | extended
C++ only __C99_COMPLEX_HEADER__ Indicates support for C99-style complex headers. c99complexheader
C only __C99_CPLUSCMT Indicates support for C++ style comments

stdc99 | extc99 | stdc 89 | extc89 | extended (also -qcpluscmt)

__C99_COMPOUND_LITERAL Indicates support for compound literals. C only stdc99 | extc99 | extc89 | extended

C++ only extended | extended0x

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

C only stdc99 | extc99 | extc89 | extended

C++ only extended | extended0x |c99__func__

__C99_HEX_FLOAT_CONST Indicates support for hexadecimal floating constants. C only stdc99 | extc99 | extc89 | extended

C++ only extended | extended0x | c99hexfloat

C only __C99_INLINE Indicates support for the inline function specifier. stdc99 | extc99 (also -qkeyword=inline)
__C99_LLONG Indicates support for C99-style long long data types and literals. C only stdc99 | extc99

C++ only extended0x | c99longlong

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

C only stdc99 | extc99 | extc89 | extended

C++ only extended | extended0x | varargmacros

__C99_MAX_LINE_NUMBER Indicates that the maximum line number is 2147483647.

C only stdc99 | extc99 | extc89 | extended

C++ only extended0x | c99preprocessor

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

C only stdc99 | extc99 | extc89 | extended

C++ only extended0x | c99preprocessor

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

C only stdc99 | extc99 | extc89 | extended

C++ only extended extended0x

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

C only stdc99 | extc99 (also -qkeyword=restrict)

C++ only extended | extended0x (also -qkeyword=restrict)

C only __C99_STATIC_ARRAY_SIZE Indicates support for the static keyword in array parameters to functions. stdc99 | extc99 | extc89 | extended
C only __C99_STD_PRAGMAS Indicates support for standard pragmas. stdc99 | extc99 | extc89 | extended
C only __C99_TGMATH Indicates support for type-generic macros in tgmath.h stdc99 | extc99 | extc89 | extended
__C99_UCN Indicates support for universal character names. C only stdc99 | extc99 | ucs

C++ only ucs

C only __C99_VAR_LEN_ARRAY Indicates support for variable length arrays. stdc99 | extc99 | extc89 | extended
C++ only __C99_VARIABLE_LENGTH_ARRAY Indicates support for variable length arrays. extended | extended0x | c99vla
__DIGRAPHS__ Indicates support for digraphs. C only stdc99 | extc99 | extc89 | extended (also -qdigraph)

C++ only extended | extended0x | compat366 | strict98(also -qdigraph)

C only __EXTENDED__

Indicates that language extensions are supported.

extended
C++ only __IBM__ALIGN Indicates support for the __align specifier. Always defined except when -qnokeyword=__alignof is specified
__IBM__ALIGNOF__ Indicates support for the __alignof__ operator.

C only extc99 | extc89 | extended

C++ only extended

__IBM_ATTRIBUTES Indicates support for type, variable, and function attributes.

C only extc99 | extc89 | extended

C++ only extended | extended0x

__IBM_COMPUTED_GOTO Indicates support for computed goto statements.

C only extc99 | extc89 | extended

C++ only extended | extended0x | gnu_computedgoto

__IBM_EXTENSION_KEYWORD Indicates support for the __extension__ keyword.

C only extc99 | extc89 | extended

C++ only extended | extended0x | compat366 | strict98

C only __IBM_GCC__INLINE__ Indicates support for the GCC __inline__ specifier. extc99 | extc89 | extended

C only __IBM_DOLLAR_IN_ID Indicates support for dollar signs in identifiers. extc99 | extc89 | extended
C only __IBM_GENERALIZED_LVALUE Indicates support for generalized lvalues. extc99 | extc89 | extended
__IBM_INCLUDE_NEXT Indicates support for the #include_next preprocessing directive.

C only Always defined

C++ only Always defined except when -qlanglvl=nognu_include_next is in effect.

__IBM_LABEL_VALUE Indicates support for labels as values.

C only extc99 | extc89 | extended

C++ only extended | extended0x |gnu_labelvalue

__IBM_LOCAL_LABEL Indicates support for local labels.

C only extc99 | extc89 | extended

C++ only extended | extended0x | gnu_locallabel

__IBM_MACRO_WITH_VA_ARGS Indicates support for variadic macro extensions.

C only extc99 | extc89 | extended

C++ only extended | extended0x | gnu_varargmacros

C only _IBM_NESTED_FUNCTION Indicates support for nested functions. extc99 | extc89 | extended
C only __IBM_PP_PREDICATE Indicates support for #assert, #unassert, #cpu, #machine, and #system preprocessing directives. extc99 | extc89 | extended
C only __IBM_PP_WARNING Indicates support for the #warning preprocessing directive. extc99 | extc89 | extended
C only __IBM_REGISTER_VARS Indicates support for variables in specified registers. Always defined.
__IBM__TYPEOF__ Indicates support for the __typeof__ or typeof keyword.

C only always defined

C++ only extended | extended0x (Also -qkeyword=typeof)

C++0x __IBMCPP_AUTO_TYPEDEDUCTION Indicates support for the auto type deduction feature.

C++ only extended0x | autotypededuction

C++0x __IBMCPP_C99_LONG_LONG Indicates support for the C99 long long feature.

C++ only extended0x | c99longlong

C++0x __IBMCPP_C99_PREPROCESSOR Indicates support for the C99 preprocessor features adopted in the C++0x standard.

C++ only extended0x | c99preprocessor

C++0x __IBMCPP_DECLTYPE Indicates support for the decltype feature.

C++ only extended0x | decltype

C++0x __IBMCPP_DELEGATING_CTORS Indicates support for the delegating constructors feature.

C++ only extended0x | delegatingctors

C++0x __IBMCPP_EXTENDED_FRIEND Indicates support for the extended friend declarations feature.

C++ only extended0x | extendedfriend

C++0x __IBMCPP_EXTERN_TEMPLATE Indicates support for the explicit instantiation declarations feature.

C++ only extended | extended0x | externtemplate

C++0x __IBMCPP_INLINE_NAMESPACE Indicates support for the inline namespace definitions feature.

C++ only extended0x | inlinenamespace

C++0x __IBMCPP_STATIC_ASSERT Indicates support for the static assertions feature.

C++ only extended0x | static_assert

C++0x__IBMCPP_VARIADIC_TEMPLATES Indicates support for the variadic templates feature.

C++ only extended0x | variadic[templates]

_LONG_LONG Indicates support for long long data types.

C only stdc99 | extc99 | | stdc89 | extc89 | extended (also -qlonglong)

C++ only extended0x | c99longlong | extended (also -qlonglong)

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
C only __STDC__ Indicates that the compiler conforms to the ANSI/ISO C standard. Predefined to 1 if ANSI/ISO C standard conformance is in effect.
__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 only stdc99 | extc99

C++ only extended0x

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.)