Language levels and language extensions

The C and C++ languages described in this reference are based on the standards listed in Standards and specifications.

We refer to the following language specifications as "base language levels" in order to introduce the notion of an extension to a base. In this context the base language levels refer to the following specifications:
Note: C++0x is a new version of the C++ programming language standard. This is a draft standard and has not been officially adopted in its entirety. Note that future levels of support for this standard are likely to change. The implementation of the language level is based on IBM's interpretation of the draft C++0x standard, and is subject to change at any time without notice. IBM makes no attempt to maintain compatibility with earlier releases, in source or binary, of the new C++0x -qlanglvl suboptions (their names or their semantics) and therefore they should not be relied on as a stable programming interface.

This information uses the term K&R C to refer to the C language plus the generally accepted extensions produced by Brian Kernighan and Dennis Ritchie that were in use prior to the ISO standardization of C.

In addition to the features supported by the base levels, XL C/C++ contains language extensions that enhance usability and facilitate porting programs to different platforms, including:
You can control the language level to be used for compilation through several mechanisms, including:

With a few exceptions, almost all of the language extensions are supported when you compile using the basic invocation commands xlc (for C) and xlc++ or xlC (for C++).

The default language level for the xlc invocation command is extc99, which includes all of the features introduced by the C99 standard, and most of the IBM extensions described in this information. For a complete listing of the C extensions and various methods for enabling them, see The IBM XL C language extensions.

The default language level for the xlC or xlc++ invocation command is extended, which includes most of the IBM extensions described in this information, as well as many C99 features. For a complete listing of the C++ extensions and methods for enabling them, see The IBM XL C++ language extensions.

For information on the various methods for controlling the language level for compilation, see Invoking the compiler and -qlanglvl.

Extensions related to C++0x standard features

XL C/C++ supports the currently-implemented C++0x features as part of a continual phased release process leading towards full compliance with C++0x. To promote compatibility and portability between C99 and C++, the XL C++ compiler enables many of the C++0x features. A complete list of C++0x features supported in XL C++ is also provided in Extensions for C++0x compatibility.

Extensions to C++ to support C99 standard features

The Standard C++ language specification does not include many of the features specified in the C99 language standard. To promote compatibility and portability between C99 and C++, the XL C++ compiler enables many of the C99 features that are supported by the XL C compiler. Since these features extend Standard C++, they are considered extensions to the base language. In this reference, unless the text is marked to indicate that a feature is supported in C or C99 only, C99 features also apply to C++. A complete list of C99 features supported in XL C++ is also provided in Extensions for C99 compatibility.

Extensions to support decimal floating-point hardware

XL C/C++ supports the built-in C decimal floating-point types proposed in Information Technology – Programming Languages – Extension for the programming language C to support decimal floating-point arithmetic, ISO/IEC WDTR 24732. This support is enabled with the -qdfp option. For compatibility with C, XL C++ also supports these native types and literals. A list of these extensions is provided in Extensions for decimal floating point support.

Extensions related to GNU C and GNU C++

Certain language extensions that correspond to GNU C and GNU C++ features are implemented to facilitate portability. These include extensions to C89, C99, C++98, and Standard C++. Throughout this information, the text indicates the IBM extensions that have been implemented for compatibility with GNU C and GNU C++; a complete list of these is also provided in Extensions for GNU C compatibility and Extensions for GNU C++ compatibility.

Extensions supporting and extending the AltiVec Programming Interface

XL C/C++ supports and extends AltiVec vector types when vector support is enabled. These language extensions exploit the SIMD and parallel processing capabilities of the PowerPC® processor, and facilitate the associated optimization techniques. The IBM implementation of the AltiVec Programming Interface specification is an extended implementation, which, for the most part, matches the syntax and semantics of the GNU C implementation. In addition to the text provided throughout this information that describes the behavior of the vector extensions, a list of the IBM extensions to the AltiVec Programming Interface is also provided in Extensions for vector processing support.