Re: Clarification on Gcc's strict aliasing rules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Segher Boessenkool" <segher@xxxxxxxxxxxxxxxxxxx> writes:

[...]

>>
>> Looking again at the second example:
>>
>> 	  int f() {
>> 	    union a_union t;
>> 	    int* ip;
>> 	    t.d = 3.0;
>> 	    ip = &t.i;
>> 	    return *ip;
>> 	  }
>>
>> could you tell me what the effective type of 't.i' object ?
>
> int, if you can say that object exists at all: it does not have a stored
> value.  The stored value of t is a double with value 3.0 .  You can
> take its address and access it via that as "double" (or "char"), or you
> can access it as the union it is.  You can not access it as "int".
>

BTW, does your reasoning rely on the C standard ?

If so could you let me know which parts exactly ?

Thanks
-- 
Francis


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux