Both long
and long long
are 64-bit types when building 64-bit on OS X. In addition, you can use the int64_t
and uint64_t
types defined in <stdint.h>
if you need to specify that an integer is exactly 64 bits wide.
You generally don't need to change existing int32
types in your program, unless they're being used to perform pointer arithmetic (or otherwise depend on them being the same size as a pointer). 32 bit arithmetic continues to work just fine in 64-bit programs. If you do have variables that must be the same size as a pointer, use the uintptr_t
type, which will work in both 32- and 64-bit builds.
The other situation where you might need to make changes is if a API expects to be passed (or returns) a size_t
or long
or intptr_t
, and you've been using int
all this time, instead of what the function in question actually specifies. It will have worked on 32-bit builds, but may introduce errors when built for 64-bit.
Yuji's suggestion of reading the 64-bit transition guides is excellent advice.