This release introduces support for a new version of the
standard for the C++ programming language - specifically C++0x. This
standard has not yet been officially adopted but we are beginning
to support some of its features.
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. The implementation
of C++0x 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
and therefore the C++0x language extension should not be relied on
as a stable programming interface.
Specifically, in this release:
- we add a new language level
- we introduce new integer promotion rules for arithmetic conversions
with long long data types
- the C++ preprocessor now supports C99 features
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++0x that are currently supported by XL C/C++.
C99 long long under C++
With
this release of XL C/C++ V11.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:
- int
- long int
- unsigned long int
- long long int
- unsigned long long
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++:
- Regular string literals can now be concatenated with wide-string
literals.
- The #line <integer> preprocessor directive
has a larger upper limit. It has been increased from 32767 to 2147483647
for C++ .
- C++ now supports _Pragma operator.
- These macros now apply to C++ as well as C:
- __C99_MACRO_WITH_VA_ARGS (also available with -qlanglvl=extended)
- __C99_MAX_LINE_NUMBER (also available with -qlanglvl=extended)
- __C99_PRAGMA_OPERATOR
- __C99_MIXED_STRING_CONCAT
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.