Re: Endian-ness of four-char constants (Was: Endian-ness of "PkgInfo" file)
Re: Endian-ness of four-char constants (Was: Endian-ness of "PkgInfo" file)
- Subject: Re: Endian-ness of four-char constants (Was: Endian-ness of "PkgInfo" file)
- From: Markus Hitter <email@hidden>
- Date: Sun, 15 Jan 2006 09:04:45 +0100
Am 14.01.2006 um 09:27 schrieb Steve Christensen:
union
{
char bytes[8];
unsigned long longs[2];
} typeCreator;
readFromPkgInfo(&typeCreator.bytes, 8);
The typeCreator.bytes would then contain
'A' 'P' 'P' 'L' 'F' 'M' 'W' 'K'
[...] and on a little-endian Intel-based computer,
typeCreator.longs[0] == 'LPPA'
typeCreator.longs[1] == 'KWMF'
In short: 'A' 'P' 'P' 'L' != 'APPL'.
That's really odd. In fact I didn't believe it until I asked a friend
to run a small test app on their Intel-based Linux machine. I'd have
sweared endianess doesn't affect how bytes are sorted, but only how
they are interpreted. I was wrong :-}
Thanks for clarification, Steve
Markus
- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden