Extensions for C99 compatibility

IBM XL C++ adds support for the following C99 language features. All of these features are enabled with the -qlanglvl=extended option, which is the default language level used when you compile with the xlC and xlc++ invocation commands. For more information, see the -qlanglvl option.

Table 35. 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

The following features are enabled with the -qlanglvl=extended option, which is the default language level used when you compile with the xlC and xlc++ invocation commands. They can also be enabled or disabled by specific compiler options, which are listed in the table below.

Table 36. 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 literals -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 table below.

Table 37. 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