What’s the difference between NSNumber and NSInteger?

NSNumber is a class, not a primitive, and is used when you need to put raw numbers into dictionaries, arrays, or otherwise encapsulate them. NSInteger, NSUInteger, CGFloat, etc are simple types and correspond (on 32-bt systems like the iPhone) to int, unsigned int and float. As a general rule, if you need to store a … Read more

Alternatives to type casting when formatting NS(U)Integer on 32 and 64 bit architectures?

From http://pubs.opengroup.org/onlinepubs/009695399/functions/printf.html: z Specifies that a following […] conversion specifier applies to a size_t or the corresponding signed integer type argument; t Specifies that a following […] conversion specifier applies to a ptrdiff_t or the corresponding unsigned type argument; And from http://en.wikipedia.org/wiki/Size_t#Size_and_pointer_difference_types: size_t is used to represent the size of any object (including arrays) in … Read more

tech