C/C++ language-related updates

The default language level for C compilations changed, and new behavior was introduced when doing arithmetic conversions with long long data types.

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.

Arithmetic conversions with long long data types

With XL C/C++ Version 9.0, compiler behavior changes when performing certain arithmetic operations with long long data types.

Assume an arithmetic expression where:
  • One operand has type long long int or long long, and,
  • The other operand has type unsigned long int, but its value cannot be represented in a long long int or long long.
Previous releases of XL C/C++ converted both operands to type long long.

The compiler now converts both operands into type unsigned long long int or unsigned long long. This new behavior is consistent with GCC compiler behavior.

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