Re: How are __LITTLE_ENDIAN__ and __BIG_ENDIAN__ defined?
Re: How are __LITTLE_ENDIAN__ and __BIG_ENDIAN__ defined?
- Subject: Re: How are __LITTLE_ENDIAN__ and __BIG_ENDIAN__ defined?
- From: "Sean McBride" <email@hidden>
- Date: Wed, 16 Nov 2005 10:30:42 -0500
- Organization: Rogue Research
On 2005-11-15 16:27, Eric Albert said:
>> Also, since only one of them is defined would it be better to use
>> #if as I did above or should I use #ifdef?
>
>In general, I prefer #if to #ifdef just because that protects you if
>someone writes code like this:
>
>#if __LITTLE_ENDIAN__
>#define __BIG_ENDIAN__ 0
>#endif
OTOH, some compilers, like CodeWarrior, will (optionally of course) give
a warning using an undefined macro in an #if test:
Warning : undefined macro '__LITTLE_ENDIAN__' used in #if or #elif conditional
HelloWorld.c line 11 #if __LITTLE_ENDIAN__
I'm not a language lawyer, so I'm not sure if it's defined behaviour to
do an #if test on an undefined macro. No doubt someone will pipe up. :)
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden