I tried the test code from dannomac and the size of 'long long' does indeed appear to be 8 bytes. gnasher729 asked the question, "So what exactly makes you think that "long long" is 4 bytes in size?" A very good question indeed. So here is a modified version of dannomac's test program:
#include <stdio.h>
#define VOID_UINT64 0xFFFFFFFFFFFFFFFF // max unsigned 64 bits
#define VOID_INT64 -9223372036854775807 // max neg signed 64 bits
int main(int argc, char **argv) {
unsigned long long ubig_var;
long long big_var;
printf("long long is %i bytes\n", sizeof(long long));
printf("big_var is %i bytes\n", sizeof(big_var));
printf("ubig_var is %i bytes\n", sizeof(ubig_var));
big_var = VOID_INT64;
ubig_var = VOID_UINT64;
printf("ubig_var = %llX\n", ubig_var);
printf("big_var = %lli\n", big_var);
return 0;
}
... and the results I get:
> gcc test.c -o test
test.c: In function 'main':
test.c:14: warning: integer constant is too large for 'long' type
test.c:15: warning: integer constant is too large for 'long' type
> test
long long is 8 bytes
big_var is 8 bytes
ubig_var is 8 bytes
ubig_var = FFFFFFFFFFFFFFFF
big_var = -9223372036854775807
>
The two warnings are for the lines where the 'long long' variables are assigned 'long long' values, but as you can see, the assignments work fine. So ... the compiler warnings are completely bogus.
FYI:
> uname -srm
Darwin 9.2.1 i386
> gcc --version
i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)