• 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 vs int vs int32_t
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSInteger vs int vs int32_t


  • Subject: Re: NSInteger vs int vs int32_t
  • From: Greg Parker <email@hidden>
  • Date: Mon, 02 Jul 2012 14:36:39 -0700

On Jul 2, 2012, at 1:10 PM, Jens Alfke <email@hidden> wrote:
> I really don't understand the thought behind creating NSInteger. It seems dangerous to have a 'standard' type whose size isn't fixed. It leads to mistakes like storing a file size in an NSUInteger — that's fine in 64-bit, but in a 32-bit app it blows up on large files. I thought we'd already learned this lesson with the old C 'int' type, which has been giving people cross-platform problems since the 1970s.

NSInteger exists to allow APIs to use 64-bit integers in 64-bit mode while preserving source- and binary-compatibility in 32-bit mode. If you start with a pile of 32-bit code that uses `int` and `@encode(int)`, then NSInteger is the correct way to move forward to 64-bit.


--
Greg Parker     email@hidden     Runtime Wrangler



_______________________________________________

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: 
 >NSInteger vs int vs int32_t (From: Andreas Grosam <email@hidden>)
 >Re: NSInteger vs int vs int32_t (From: Jens Alfke <email@hidden>)
 >Re: NSInteger vs int vs int32_t (From: Chris Hanson <email@hidden>)

  • Prev by Date: Re: Adding Properties to NKIssue?
  • Next by Date: Re: UITableView woes
  • Previous by thread: Re: NSInteger vs int vs int32_t
  • Next by thread: Re: NSInteger vs int vs int32_t
  • Index(es):
    • Date
    • Thread