|
From: Tom H. <to...@co...> - 2013-02-04 17:45:53
|
On 04/02/13 17:25, Patrick J. LoPresti wrote: > Never access an object via the wrong pointer type. The only exception > is "char *", which can alias anything by definition. (You can also > use a union to access the same memory as different types. I believe > this takes you into the realm of implementation-defined behavior. > That is also bad, in my opinion, but it is not the disaster of > undefined behavior.) The C standard says you can only read a union through the member it was last written through. My guess would be that doing otherwise is invokes undefined behaviour, but you could be right that is is "just" implementation defined. Tom -- Tom Hughes (to...@co...) http://compton.nu/ |