svn commit: r250990 - head/include

Tijl Coosemans tijl at coosemans.org
Mon May 27 15:26:25 UTC 2013


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; })

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/svn-src-all/attachments/20130527/aa7cb881/attachment.sig>


More information about the svn-src-all mailing list