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.
  • C++11
  • C++03
  • C++98
  • C99
  • C89

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 C11 standard features

C11
Note: IBM supports selected features of C11, known as C1X before its ratification. IBM will continue to develop and implement the features of this standard. The implementation of the language level is based on IBM's interpretation of the standard. Until IBM's implementation of all the C11 features is complete, including the support of a new C11 standard library, the implementation may change from release to release. IBM makes no attempt to maintain compatibility, in source, binary, or listings and other compiler interfaces, with earlier releases of IBM's implementation of the C11 features.
C11

XL C/C++ supports the currently implemented C11 features as part of a continual phased release process leading towards full compliance with C11. A complete list of C11 features supported in XL C/C++ is provided in C11 compatibility.

Extensions related to C++11 standard features

C++11
Note: IBM supports selected features of C++11, known as C++0x before its ratification. IBM will continue to develop and implement the features of this standard. The implementation of the language level is based on IBM's interpretation of the standard. Until IBM's implementation of all the C++11 features is complete, including the support of a new C++11 standard library, the implementation might change from release to release. IBM makes no attempt to maintain compatibility, in source, binary, or listings and other compiler interfaces, with earlier releases of IBM's implementation of the new C++11 features.
C++11

XL C/C++ supports the currently-implemented C++11 features as part of a continual phased release process leading towards full compliance with C++11. A complete list of C++11 features supported in XL C++ is provided in C++11 compatibility.

Extensions to C++ to support C99 and C11 standard features

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

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, C++03, and C++11. 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 provided in Extensions for GNU C compatibility and Extensions for GNU C++ compatibility for C++ only.

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.

Extensions supporting Unicode

The Unicode Standard is the specification of an encoding scheme for written characters and text. It is a universal standard that enables consistent encoding of multilingual text and allows text data to be interchanged internationally without conflict. The ISO C and ISO C++ Committees have approved the implementation of u-literals and U-literals to support Unicode UTF-16 and UTF-32 character literals, respectively. See Extensions for Unicode support for details.



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us