Brian
Brian

Reputation: 3601

Which integer types to use for Core Data integers

Core Data has int16, int32, and int64. When working with these in their NSNumber form should I use NSInteger or int ( and their respective NSNumber methods numberWithInt, numberWithInteger ). I have been using int for int16 and NSInteger for int32, but I don't know if this is correct. I would just like some clarification.

Upvotes: 6

Views: 3308

Answers (1)

Grady Player
Grady Player

Reputation: 14549

NSInteger is at least 32 bit, as is int. I wouldn't ever use int16, unless you need to represent a short.

NSInteger can also be 64 bit, in a 64bit runtime...

Upvotes: 4

Related Questions