"Segher Boessenkool" <segher@xxxxxxxxxxxxxxxxxxx> writes: >>>> 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 ? > > Of course it does. Perhaps I don't understand what you're asking here. > Ok, if I understand correctly you previous post, you say that after the following expression statement: t.d = 3.0; the stored value of t is a double and I agree. You also said and I still agree that: - you can take its adress and access it via that as double (or "char"): double *d = &t.d; - you can access it as the union it is (I'm not sure if that what you meant): double d = t.d; But you finally said - you can not access it as int: that object (t.i) does not have a stored value therefore it doesn't exist. This is what I understood from what you said, please correct me if I'm wrong. However doing: int i = t.i; is defined in C (as long as there's no trap representation) even if 't.i' object has no stored value. So I assume that 't.i' always exists, and doing: int *i = &t.i; 6.5p6 said that the effective type of 't.i' is 'int' whatever the value stored in 't'. -- Francis