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

NSInteger vs int vs int32_t


  • Subject: NSInteger vs int vs int32_t
  • From: Andreas Grosam <email@hidden>
  • Date: Mon, 02 Jul 2012 13:24:06 +0200

In a public API, I have to specify integer arguments and return values. The API would be for Objective-C on iOS and Mac OS. What is the preferred type to use in several use cases?

For example, one API would need to use an unsigned integer whose values will be quite small, say in a range 0 ... 100, that is an uint16_t would be sufficient. (well, I would choose a uint32_t, here).


Anyway, is it preferable to use always Cocoa macros (NSInteger, NSUInteger, etc.) for an Objective-C API - or may/should I use int, unsigned int, or maybe int32_t, uint32_t, etc. when it seems more appropriate?


_______________________________________________

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 vs int vs int32_t
      • From: Jens Alfke <email@hidden>
    • Re: NSInteger vs int vs int32_t
      • From: Fritz Anderson <email@hidden>
    • Re: NSInteger vs int vs int32_t
      • From: Alex Zavatone <email@hidden>
  • Prev by Date: NSUndoManager setActionName: oddity
  • Next by Date: Re: Base64 encoding of NSImage
  • Previous by thread: Re: NSUndoManager setActionName: oddity
  • Next by thread: Re: NSInteger vs int vs int32_t
  • Index(es):
    • Date
    • Thread