views:

73

answers:

2

Is an NSInteger big enough for UInt32? Or is it even the same thing?

+2  A: 

No because NSInteger is a signed type while UInt32 is unsigned.

You should inspect the definitions of these types in Apple's header files to understand what they mean. It's very easy to do so. From an open project in Xcode, select File -> Open Quickly... (Command-Shift-D) and type the type name you are interested in into the text field. It will find the file where it is defined. Or just Command-double click a type in your source code.

Ole Begemann
also, `NSInteger` is 32 bit only when building 32 bit applications
Christoph
how about NSUInteger?
dontWatchMyProfile
+1  A: 

Here is code from NSObjCRuntime.h (from the iPhone SDK 3.2 install):

#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
jessecurry