Re: std::complex standard packing requirements was Re: [eigen] FFT for Eigen

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


2009/5/19 Mark Borgerding <mark@xxxxxxxxxxxxxx>:
> I had this discussion a few years ago on comp.lang.c++ when I was trying to
> share complex buffers between  c99 libs and C++ apps.
> The bottom line is that the original  C++ ISO standard did not require
> array[2] packing for std::complex, but that requirement was in the standards
> pipeline and all sane compilers already do it.
>
> http://www.cpptalk.net/portable-complex-numbers-between-c-c--vt46432.html
> http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#387

Thanks a lot!

> It should be safe enough to go down that path, but it would still be good to
> add a compile time check to ensure
> sizeof( std::complex<T> ) ==  2*sizeof(T)
> and a runtime check for
> &cpx.imag()  -  &cpx.real() == 1

I'd rather see them in the unit-tests, as this kind of thing could end
up unneededly slowing compilation (for static asserts) and execution
(normal asserts).

Cheers,
Benoit



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/