Integer Length for Intel Core 2 Duo (MAC OSX)

by cjm2176
Tags: core, integer, intel, length
 P: 8 Hello all, I am trying to determine if my machine is 64 bit or 32 bit, according to this site: http://support.apple.com/kb/ht3696 the Intel Core 2 Duo I am using is 64 bit, but when I run the following code #include int main(int argc, char **argv) { char c; int i; float f; double d; long l; long long ll; printf("char %ld, int %ld, long %ld, long long %ld, float %ld, double %ld, pointers %ld\n", 8*sizeof(c), 8*sizeof(i), 8*sizeof(l), 8*sizeof(ll), 8*sizeof(f), 8*sizeof(d), 8*sizeof(&c)); } I get the output: char 8, int 32, long 32, long long 64, float 32, double 64, pointers 32 If my machine is 64 bit should I be getting int 64 instead of int 32? If yes could this be a problem? I am using GNU compilers, i.e. gcc. Thanks cjm2176
 PF Gold P: 469 No, int is 32 bits. long long int would be a 64 bit signed integer. or compile with the -m64 switch (or is it -arch x86_64 on mac? something like that)
 P: 8 Ok thanks, are the other types the expected length for 64 bit? such as float and pointer?
Mentor
P: 21,215
Integer Length for Intel Core 2 Duo (MAC OSX)

 Quote by cjm2176 Ok thanks, are the other types the expected length for 64 bit? such as float and pointer?
The code you showed has more to do with the code that the compiler generates than with the size of a register on your computer.

32 bits for a float is pretty standard and 64 bits for a double, which you didn't check. The fact that your compiler reports that a pointer is 32 bits makes me think that your compiler is generating 32-bit code.
 HW Helper P: 7,033 I tested your source code on Windows XP X64, using Microsoft Visual Studio (2005) in 64 bit mode, the only difference is that the pointers are 64 bit. Check to see if your compiler has a 64 bit compile option. For Visual Studio, the project build configuration has to be set to x64 to get 64 bit mode.

 Related Discussions Classical Physics 0 General Engineering 0 Computers 3 Quantum Physics 1 Computing & Technology 6