In LP64, the size of a long
and the size of a long long
are the same (Apple Docs, Unix Docs).
Is there any difference then, when limiting yourself to the understanding that you're running on an LP64 system (as XCode appears to when compiling for 64 bit), between a long
and a long long
? Is there any performance reason to use a long
instead of a long long
if your goal is a 64 bit integral?
Here's why I ask. In Objective C on Xcode, NSString's format (like printf) and NSNumber both use data types like int
, long
, long long
and their unsigned variants when converting numbers and text and not specific bit length numbers like int16_t
, int32
. and int64_t
. This would make it difficult to program things that require a certain minimum size (i.e. networking or currency applications) or times when you want to store specifically sized data into an NSNumber without typecasting.
Is it safe, limiting to any Intel Mac OS or iOS device, to use int
for int32_t
and long long
for int64_t
when interacting with things like NSString's format functions and NSNumber?