Re: I hate

Andrew Kohlsmith <[email protected]> Thu, 13 May 2004 09:25:01 -0400
Newsgroups gmane.comp.java.xwt.core
Organization Benshaw Canada
Message-ID <[email protected]>
> attention all programmers everywhere: do not write to one member of a
> union and then read from another one and expect it to work!

... Why shouldn't it work?  I don't know Pascal but I was under the impression 
that was the *specific* reason for unions in C.

union {
	short s1;
	int i1;
	long l1; } mystuff;

mystuff.l1 = 0xffffffff;
mystuff.i1 = 0xaaaa;
mystuff.s1 = 0x00;

mystuff.l1 should now be 0xffffaa00, should it not?

Regards,
Andrew