Extensions for C99 compatibility

IBM® XL C++ adds the support for the following C99 language features. All of these features are enabled with the -qlanglvl=extended option, which is the default language level.

Table 1. Default C99 features as extensions to Standard C++
Language feature Discussed in:
Duplicate type qualifiers Type qualifiers
Flexible array members at the end of a structure or union Flexible array members
_Pragma operator The _Pragma preprocessing operator
Additional predefined macro names Standard predefined macro names
Empty arguments in function-like macros Function-like macros
C standard pragmas Standard pragmas (C only)

The following features are enabled with the -qlanglvl=extended option, which is the default language level. They can also be enabled or disabled by specific compiler options, which are listed in the below table:

Table 2. Default C99 features as extensions to Standard C++, with individual option controls
Language feature Discussed in: Individual option controls
__func__ predefined identifier The __func__ predefined identifier -qlanglvl=[no]c99__func__
Hexadecimal floating-point literals Hexadecimal floating-point literals -qlanglvl=[no]c99hexfloat
Complex data type Complex floating-point types -qlanglvl=[no]c99complex
Trailing comma allowed in enum declaration Enumeration type definition -qlanglvl=[no]trailenum
The restrict type qualifier The restrict type qualifier -q[no]keyword=restrict
Variable length arrays Variable length arrays -qlanglvl=[no]c99vla
Compound literals Compound literal expressions -qlanglvl=[no]c99compoundliteral
Variable arguments in function-like macros Function-like macros -qlanglvl=[no]varargmacros

The following feature is only enabled by a specific compiler option, listed in the below table:

Table 3. C99 features as extensions to Standard C++, with individual option controls
Language feature Discussed in: Individual option control
Universal character names The Unicode standard -qlanglvl=ucs