Register to reply

Integer Length for Intel Core 2 Duo (MAC OSX)

by cjm2176
Tags: core, integer, intel, length
Share this thread:
cjm2176
#1
Aug3-11, 05:29 PM
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 <stdio.h>

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
Phys.Org News Partner Science news on Phys.org
New type of solar concentrator desn't block the view
Researchers demonstrate ultra low-field nuclear magnetic resonance using Earth's magnetic field
Asian inventions dominate energy storage systems
DavidSnider
#2
Aug3-11, 05:49 PM
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)
cjm2176
#3
Aug3-11, 06:15 PM
P: 8
Ok thanks, are the other types the expected length for 64 bit? such as float and pointer?

Mark44
#4
Aug3-11, 06:50 PM
Mentor
P: 21,249
Integer Length for Intel Core 2 Duo (MAC OSX)

Quote Quote by cjm2176 View Post
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.
rcgldr
#5
Aug3-11, 07:45 PM
HW Helper
P: 7,107
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.


Register to reply

Related Discussions
Height/length of teeth in stator core Classical Physics 0
Is CST MWS 5.0 Compatible with Intel Core 2 Quad Processor? General Engineering 0
Will an Intel Core i7 920 be faster than this CPU? Computers 3
Distance=Planck Length * integer value? Quantum Physics 1
Intel Dual Core Hyper Threading Processors Computing & Technology 6