G
Glen Low
Suppose I have a complex number as follows:
double _Complex d;
Can I access the real part as
((double*) d) [0]
and the imaginary part as
((double*) d) [1] ?
The C99 seems to say yes in 6.25/13 which specifies the layout of
complex numbers, and possibly no in 6.5/7 which may rule out double
_Complex and double aliasing?
I'm trying to find a portable way of using gcc's __real__ and __imag__
extensions, which work as lvalues.
Cheers,
Glen Low, Pixelglow Software
www.pixelglow.com
double _Complex d;
Can I access the real part as
((double*) d) [0]
and the imaginary part as
((double*) d) [1] ?
The C99 seems to say yes in 6.25/13 which specifies the layout of
complex numbers, and possibly no in 6.5/7 which may rule out double
_Complex and double aliasing?
I'm trying to find a portable way of using gcc's __real__ and __imag__
extensions, which work as lvalues.
Cheers,
Glen Low, Pixelglow Software
www.pixelglow.com