Re: I hate

Andrew Kohlsmith <[email protected]> Fri, 14 May 2004 07:34:14 -0400
Newsgroups gmane.comp.java.xwt.core
Organization Benshaw Canada
Message-ID <[email protected]>
> Certainly not. For all you know sizeof(short) == sizeof(int) ==
> sizeof(long). Even if they aren't you don't know what endianness the
> target platform is. And even if you know all that. The compiler can
> perfectly legally treat the above as just a plain old struct and not
> have the  memory overlapping at all!

Well yes, I am of course assuming ix86 in my example -- you'd have to write it 
cleanly for architecture-independence.

if structs and unions are no different to a compiler, then why are they 
differently named?  I have to admit I've been C programming for over 15 years 
now and have never had much use for union, but I was under the impression 
that they were structures that had their elements overlapped.

Regards,
Andrew