Re: std::complex standard packing requirements was Re: [eigen] FFT for Eigen |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: std::complex standard packing requirements was Re: [eigen] FFT for Eigen
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Tue, 19 May 2009 23:48:17 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=h5vzTT3qCFyGOqlLpRVezVh5RiU+lsZJGJRzqe1wlp0=; b=NbrXXMImOE+0KNhnOrKNyxXKyYvMvkvS7qZwO3MuHnStZcUNyYe8OpXr0aiw0roVZp 5mNJJOtvmojT1bWQ8OjR+aV/tM7L3frD9w0Dn45S1b9M2MP0mTmPuLnDL2mtaw7b0tTB Q4ZU+nQ07UdSr8LkCUovvP9rYSMcNw+43xqtg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=P22znC/kHRKI3KRoPLXffUVUwdn6eq2Mz9oi5Ir+Vf3KS4qYor8W9fmhuqBQcSza4s jaedYKFMO1N0+1MeEgubLT7VSRzq4OQJGg1VxTYqWfLfqyDOxXDhkpaFz/gYNHwC+k6u z+fWk1dQ9gcoQqHXy77Z/m+14VtkO8Xk8Y2u4=
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