In general, it will work. NSInteger will always be at least 32 bits long. If it's 64 bits, your number will be extended to match (you may need to drop it). This will not result in runtime errors.
Details about NSInteger
NSInteger is defined using the following code (from NSObjCRuntime.h):
#if __LP64__ || TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64 typedef long NSInteger; typedef unsigned long NSUInteger; #else typedef int NSInteger; typedef unsigned int NSUInteger; #endif
This means that NSInteger equivalent to long when compiling for a 64-bit version, embedded OS, iPhone, Windows, or when building a 32-bit bit, such as 64 bits. Otherwise, it is equivalent to int . Since int and int32_t equivalent, you will be fine in 32-bit applications on OS X. In other situations, this depends on the size of the long .
In 64-bit applications, OS X long is a 64-bit number. On iPhone, long is a 32-bit number. I do not know about Windows, and I'm not sure if it uses 32-bit or 64-bit length when building 32-bit, like 64-bit.
source share