Code:
NSLog(@"Long is %i bytes", sizeof(long));
NSLog(@"Unsigned long is %i bytes", sizeof(unsigned long));
gets
Code:
Long is 8 bytes
Unsigned long is 8 bytes
(Running 10.6 on 2010 MacBook Pro 13", not sure if that matters.)
NSLog(@"Long is %i bytes", sizeof(long));
NSLog(@"Unsigned long is %i bytes", sizeof(unsigned long));
Long is 8 bytes
Unsigned long is 8 bytes
Code:NSLog(@"Long is %i bytes", sizeof(long)); NSLog(@"Unsigned long is %i bytes", sizeof(unsigned long));
gets
I thought long is 4 bytes and long long is 8 bytes?Code:Long is 8 bytes Unsigned long is 8 bytes
(Running 10.6 on 2010 MacBook Pro 13", not sure if that matters.)
#include <stdio.h>
#include <execinfo.h>
int main(int argc, char *argv[]) {
printf("size is %zd\n",sizeof(long));
return 0;
}
This is why it is always safer to use the C99 types if you want a specific integer size.
Such as uint8_t and int64_t for instance.
Code:(Running 10.6 on 2010 MacBook Pro 13", not sure if that matters.)[/QUOTE] It matters immensely. That model is 64-bit capable, and 10.6 defaults to 64-bit when the CPU is 64-bit capable.
It matters immensely. That model is 64-bit capable, and 10.6 defaults to 64-bit when the CPU is 64-bit capable.