Andrew Haley <aph <at> redhat.com> writes: > but > > (union u*)&i > > is not a legal lvalue expression because the dereference is undefined > behaviour.
Your example does not contain a dereference. > You may only dereference a pointer as permitted by 6.3.2.3. 6.3.2.3 does not mention dereferencing at all; it only addresses pointer conversion. Dereferencing is defined in 6.5.3.2. But let me ask you this. What do you think 6.5 paragraph 7 means? For example, are you also of the opinion that this is illegal? int i; unsigned int *pui = (unsigned int*)&i; unsigned int ui = *pui; I believe that GCC allows this (Richard can correct me if I am wrong), but under your interpretation this would be illegal because "int" and "unsigned int" are not compatible types. The only thing that makes this legal is 6.5 paragraph 7, where one of the allowed aliasing scenarios is: a type that is the signed or unsigned type corresponding to the effective type of the object Josh