C++11 features

XL C/C++ V10.1 introduces support for a new version of the standard for the C++ programming language - specifically C++11, also known as C++0x before its ratification. The standard was not officially adopted at the time of the release but we began to support some of its features.

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 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 new C++11 features.
Specifically, in this release:

New language level - extended0x

The default -qlanglvl compiler option remains extended when invoking the C++ compiler.

A new suboption has been added to the -qlanglvl option in this release. -qlanglvl=extended0x is used to allow users to try out early implementations of any features of C++11 that are currently supported by XL C/C++.

C99 long long under C++

With this release of XL C/C++, V10.1, compiler behavior changes when performing certain arithmetic operations with integral literal data types. Specifically, the integer promotion rules have changed.

Previously, in C++ (and as an extension to C89), when compiling with -qlonglong, an unsuffixed integral literal would be promoted to the first type in this list into which it fitted:

Starting with this release and when compiling with -qlanglvl=extended0x, the compiler now promotes unsuffixed integral literal to the first type in this list into which it fits:
  • int
  • long int
  • long long int
  • unsigned long long
Note: Like our implementation of the C99 Standard in the C compiler, C++ will allow promotions from long long to unsigned long long if a value cannot fit into a long long type, but can fit in an unsigned long long. In this case, a message will be generated.

The macro __C99_LLONG has been added for compatibility with C99. This macro is defined to 1 with -qlanglvl=extended0x and is otherwise undefined.

For more information, see Integral and floating-point promotions.

Preprocessor changes

The following changes to the C++ preprocessor make it easier to port code from C to C++:

Note: Except as noted, these C++ preprocessor changes are only available when compiling with -qlanglvl=extended0x.

For additional information about the language standards supported by XL C/C++, see Language levels and language extensions.