On Mon, Feb 9, 2009 at 10:04 AM, Sean McBride <s...@rogue-research.com> wrote:
> On 2/8/09 11:14 PM, Clark Cox said:
>
>>> A somehow related question:
>>> How does one find out, in which mode (32 vs. 64 bit) an app is running?
>>
>>#ifdef __LP64__
>
> Apple's headers inconsistently use #if and #ifdef.

Because #if and #ifdef will both give the proper result in this
instance (i.e. the GCC compiler either defines __LP64__ to true, or it
doesn't define it at all), they are interchangeable.

> I recommend:
>
> #if defined (__LP64__) && __LP64__

FYI, there is no functional difference between:

#if defined (SOMEMACRO) && SOMEMACRO

and

#if SOMEMACRO

That is, the preprocessor treats any undefined identifier in an '#if'
or '#elif" as if it were defined to be zero.

> which will also not warn with -Wundef.

My original #ifdef won't trigger this warning either, therefore it is
the best of all options (i.e. it's concise, doesn't trigger warnings,
and provides the correct result).

-- 
Clark S. Cox III
clarkc...@gmail.com
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to