NSInteger vs int

What is the reason for using NSInteger vs int in iPhone programming? Thanks.

+3
source share
1 answer

An NSIntegeris just a typedef with the following definition:

#if __LP64__ || NS_BUILD_32_LIKE_64
  typedef long NSInteger;
  typedef unsigned long NSUInteger;
#else
  typedef int NSInteger;
  typedef unsigned int NSUInteger;
#endif

Since typedef is defined differently on the platform, you can use it NSIntegerregardless of the platform.

+3
source

Source: https://habr.com/ru/post/1726155/


All Articles