C/C++ language-related updates

The default language level for C compilations changed, and new support for extensions to the C and C++ programming languages was introduced.

Default language level changed for C - extc99

The default -qlanglvl compiler option setting is extc99 when invoking the C compiler with the xlc invocation. This change allows you to use C99 features and headers without having to explicitly specify the extc99 suboption.

You might encounter issues with the following when compiling with the new default -qlanglvl=extc99 setting:
  • Pointers can be qualified with restrict in C99, so restrict can not be used as an identifier.
  • C99 treatment of long long data differs from the way long long data is handled in C89.
  • C99 header files define new macros: LLONG_MAX in limits.h, and va_copy in stdarg.h.
  • The value of macro __STDC_VERSION__ changes from 199409 to 19990.

To revert to previous xlc behavior, specify -qlanglvl=extc89 when invoking the compiler.

Decimal floating point support for C and C++

Decimal floating point arithmetic offers greater computational performance and precision in business and financial applications where numeric data I/O is usually performed in decimal form. Data conversions from decimal type to binary floating point type and back are avoided, as are inherent rounding errors accumulated during data conversions.

XL C/C++ adds support for decimal floating point arithmetic with the following new compiler options:

Table 1. Decimal floating point compiler options
Option/directive Description
-qdfp|-qnodfp Specifying -qdfp enables compiler support for decimal floating-point data types and literals. If you specify -qdfp when compiling for an architecture that does not support decimal floating-point computation, the compiler will assume -qfloat=dfpemulate and enable software emulation of decimal floating-point computations.
-qfloat= dfpemulate|nodfpemulate Specifying -qfloat=dfpemulate instructs the compiler to use software emulation when handling decimal floating point computations. This option can be used with any architecture supported by XL C/C++.
-y There are suboptions specific to decimal floating-point arithmetic for the -y option to control rounding of constant expressions.
Note: Compiler support for decimal floating point operations requires AIX 5L™ for POWER® version 5.3 with the 5300-06 Technology Level or higher.

For more information, see Extension for the programming language C to support decimal floating-point arithmetic: TR 24732 and Decimal Types for C++: Draft 4.

TR1 library extensions for C++

XL C/C++ Version 9.0 introduced support for numerous extensions to the C++ language as defined by the Draft Technical Report on C++ Library Extensions (TR1).

For more information on these language extensions, see Draft Technical Report on C++ Library Extensions (TR1).