When should I be using NSInteger
vs. int when developing for iOS? I see in the Apple sample code they use NSInteger
(or NSUInteger
) when passing a value as an argument to a function or returning a value from a function.
- (NSInteger)someFunc;...
- (void)someFuncWithInt:(NSInteger)value;...
But within a function they're just using int
to track a value
for (int i; i < something; i++)
...
int something;
something += somethingElseThatsAnInt;
...
I've read (been told) that NSInteger
is a safe way to reference an integer in either a 64-bit or 32-bit environment so why use int
at all?