Why is there NSInteger and not NSLong or even NSLongLong?

791 views Asked by At

NSInteger is integer object. So surely there should be long object?

2

There are 2 answers

5
rckoenes On BEST ANSWER

NSInteger and NSUInteger are platform specific, so on 32 bit system is declared as an int and on 64 bit system it is declared as a long.

0
Michael Dautermann On

NSInteger is a foundation type, as you can see here.

There are also other useful primitive types, like NSRect, NSSize, etc.

Apple simply chose not to have a NSLong or NSLongLong type defined in foundation.

More information as to when to use NSInteger (and what the considerations are behind them) can be found in this related question.