If I remember correctly, on some machine, int
was 16 bit, and when we move onto the 32 bit platform, then int
was 32 bit.
Now that Snow Leopard and Lion are 64 bit, can a C or Objective-C program be compiled on Xcode so that int
is 64 bit? (and "%d" or "%i" will take a 64 bit integer as well). Or is int
kept as 32-bit for compatibility reason?
(and if using 64 bit int
, will it be faster than 32 bit because 64 bit is native?)
Update: I just found out sizeof(NSInteger)
if printed in a console app by Xcode on Lion is 8 (it is typedef as long), and if it is on iOS 5.1.1, then it is 4 (typedef as int). sizeof(int)
is 4 on both platforms. So it looks like in a way, int
moved from 16 bit to 32 bit before, but now we do want to stop it at 32 bit.