• 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: NSInteger/NSUInteger Considerations (64 bit)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSInteger/NSUInteger Considerations (64 bit)


  • Subject: Re: NSInteger/NSUInteger Considerations (64 bit)
  • From: Chris Hanson <email@hidden>
  • Date: Wed, 26 Mar 2014 10:05:03 -0700

On Mar 25, 2014, at 4:55 PM, Jens Alfke <email@hidden> wrote:

> So if something is supposed to be a particular size (as seems to happen in your app) declare it as a type of that size. If you don’t care about the size and it won’t ever exceed a few billion, use `int` or `unsigned`. If it needs to hold huge values, or if you want to be really conservative, use `SInt64` or `UInt64`.

You should generally prefer NSInteger and NSUInteger if you're writing code to fit Cocoa patterns and the <stdint.h> types (uint32_t etc.) if you're writing code that needs exact-width or minimum-width integers (the header has both).

I'd avoid legacy Carbon types like "SInt32" in new code; compatibility needs may require them to be defined in different ways than you expect.

  -- Chris


_______________________________________________

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


  • Follow-Ups:
    • Re: NSInteger/NSUInteger Considerations (64 bit)
      • From: Dave <email@hidden>
References: 
 >NSInteger/NSUInteger Considerations (64 bit) (From: Dave <email@hidden>)
 >Re: NSInteger/NSUInteger Considerations (64 bit) (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Simulating sublayers in CATiledLayer
  • Next by Date: accessing values along NSIndexPath
  • Previous by thread: Re: NSInteger/NSUInteger Considerations (64 bit)
  • Next by thread: Re: NSInteger/NSUInteger Considerations (64 bit)
  • Index(es):
    • Date
    • Thread