This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: <addr_expr <realpart_expr <x>>> ?


Richard Henderson <rth@redhat.com> writes:

| On Sun, Jan 11, 2004 at 02:23:49AM +0100, Gabriel Dos Reis wrote:
| > There is a layout requirement that if z is __complex__ then it acts as
| > if it were an array of two scalars.  In particular __real__ is 
| > the first element and __imag__ is the second.
| 
| Ok...
| 
| > They are going to act like lvalues.
| 
| How does that follow?  I expect this requirement only means that
| 
| 	union {
| 	  _Complex float z;
| 	  float f[2];
| 	};
| 
| is guaranteed to do what you expect.

There is no standard requirement that your union has anything to do my
expectations. 

However, what I meant is this

    double* r = ((double)(*)[2])&z;
    double* i = r + 1;

__real__ z is equivalent to *r and __imag__ z is equivalent to *i.

In particular, if __real__z = 4 is well-formed,, then logically it
should be an lvalue.

-- Gaby
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]