"Jeroen T. Vermeulen" <jtv@xs4all.nl> writes:
> This trick may work on some compilers and/or platforms, but it's not
> correct C. The language does not guarantee that the members of a union
> will be allocated in the exact same address, or even that they will
> overlap.
Nonsense. C99 6.7.2.1:
A pointer to a union object, suitably converted, points to each of its members (or if a member is a
bit-field,then to the unit in which it resides), and vice versa.
It does say that the results of fetching a union member other than
the one last stored to are implementation-dependent, but not that
the implementation can choose to put them in different places.
regards, tom lane