Originally posted by: rcraik
Good new! The more focused community about XL compilers on POWER is now available at http://ibm.biz/xl-power-compilers.
If you are interested in the XL compilers on POWER, you may want to join the new community and subscribe to updates there. See you there!
This site remains the Cafe for C/C++ compilers for IBM Z.
The latest version of XL C/C++ for little endian Linux distributions is fully C11 compliant! In addition to all of the features supported by V13.1.1, the new version 13.1.2 also supports generic selection expressions, making it possible to overload an expression based on type; and also makes it much simpler to initialise complex floating point numbers via the CMPLX macros. See below for more details:
Complex value initialisations
The C11 standard specifies three new macros for initialising complex numbers:
#include <complex.h> double complex CMPLX(double x, double y);
float complex CMPLXF(float x, float y);
long double complex CMPLXL(long double x, long double y);
Each will expand to an expression of the specified complex type with the specified real (x) and imaginary (y) values. For example:
float complex cf = CMPLXF(1.0f, 2.0f);
cf will be initialised with a value of 1.0f + i 2.0f
These new C11 macros now provide a way to initialise complex numbers with an imaginary value of infinity or NaN, which was not previously possible in a general way.
For more information see section 18.104.22.168 of the C11 standard.
The generic selection expression provides a mechanism for making a compile-time selection between several different expressions based on the type of a controlling expression. This makes it simple to define type-generic macros, as in the following example:
#define SQRT(X) _Generic((X), \
float: sqrtf(X), \
double: sqrt(X), \
long double: sqrtl(X))
For each use of this SQRT macro, the type of X will be deduced by the compiler, and this type will be used to select the appropriate function to actually call. So, if the user wrote SQRT(1.1f), the compiler would replace it with a call to sqrtf(1.1f).
For more information see section 22.214.171.124 of the C11 standard.
Why not get hold of the new XL C/C++ V13.1.2 for little endian Linux distributions and give these new features a go!