Re: NSInteger vs int vs int32_t
Re: NSInteger vs int vs int32_t
- Subject: Re: NSInteger vs int vs int32_t
- From: Alex Zavatone <email@hidden>
- Date: Mon, 02 Jul 2012 11:07:10 -0400
I'm no expert, but in my experience, I'd say it's certainly safer to use a variables that are able to play well in a Cocoa collection, if you're going to need to use other routines like writing them out to a pList or serialize them in a dictionary.
I found this out when trying to serialize JSON and also when trying to write out an annotation list to a pList. There is a struct in a CLCoordinate and this breaks both of the operations.
On Jul 2, 2012, at 7:24 AM, Andreas Grosam wrote:
> 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
_______________________________________________
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