Recently I came across the question NSString: Why use static over literal? and in the comments arrived a new question.
In Objective-C there some "special" types that are just maps to C primitives. Like the
#if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64 typedef long NSInteger; #else typedef int NSInteger; #endif
I know how to use the
static keywords for objects but I don't understand the implications on C primitive types.
When should I use a
static NSInteger x instead of
NSInteger x? What happens with the memory in both cases?