• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NS_BUILD_32_LIKE_64
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NS_BUILD_32_LIKE_64


  • Subject: Re: NS_BUILD_32_LIKE_64
  • From: Lee Ann Rucker <email@hidden>
  • Date: Sat, 11 Jun 2011 01:38:24 -0700 (PDT)

If it's only NSLog formatting that's an issue, a trick we use for cross-platform printfs is a conditional macro (this is off the top of my head; ours is conditional on Windows or Mac/Linux):

#if __LP64__
#define FMT_NSUInt "%lu"
#else
#define FMT_NSUInt "%u"
#endif

NSLog(@"u = "FMT_NSUInt" etc", u);


----- Original Message -----
From: "Gerriet M. Denkmann" <email@hidden>
To: email@hidden
Sent: Saturday, June 11, 2011 12:54:39 AM
Subject: NS_BUILD_32_LIKE_64

When I define NS_BUILD_32_LIKE_64=1 I can simply write:

NSUInteger u = 12;
NSLog(@"u = %lu", u );

Otherwise I would need to use a cast like:
NSLog(@"u = %lu", (unsigned long)u );

or even more clumsy:

#if __LP64__
	NSLog(@"u = %lu", u );
#else
	NSLog(@"u = %u", u );
#endif

The 64-Bit Transition Guide for Cocoa just says:
"The NS_BUILD_32_LIKE_64 macro is useful when binary compatibility is not a concern, such as when building an application."

So: why is this NS_BUILD_32_LIKE_64 not always defined (as default) and what binary compatibility issues I have to be aware of?


Kind regards,

Gerriet.



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >NS_BUILD_32_LIKE_64 (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: NS_BUILD_32_LIKE_64
  • Next by Date: Re: NS_BUILD_32_LIKE_64
  • Previous by thread: NS_BUILD_32_LIKE_64
  • Next by thread: Re: NS_BUILD_32_LIKE_64
  • Index(es):
    • Date
    • Thread