On 2013-05-27 10:34, David Schultz wrote: > On Sat, May 25, 2013, Ed Schouten wrote: >> Author: ed >> Date: Sat May 25 18:55:55 2013 >> New Revision: 250990 >> URL: http://svnweb.freebsd.org/changeset/base/250990 >> >> Log: >> Add C11 macros CMPLX(), CMPLXF() and CMPLXL(). >> >> Clang allows us to initialize complex numbers using an array >> initializer, casted to a complex type. GCC has a builtin called >> __builtin_complex(). > > Awesome, thanks! I recall that we talked about this last year, and > the blocking issue was that gcc didn't support it. It appears > that the one in the base system still doesn't, but now that clang > is the default compiler, maybe that doesn't matter. > > There are some regression tests in tools/regression/lib/msun that > could be converted to exercise these macros if you wish: grep for > "cpack".
You could add a cpack-like fall-back for old gcc. It's not usable for static initialisation, but maybe it's better than nothing. #define CMPLX(x, y) __extension__({ double complex __z; \ __real__ __z = (x); __imag__ __z = (y); __z; })
signature.asc
Description: OpenPGP digital signature