Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Integer Length for Intel Core 2 Duo (MAC OSX)

  1. Aug 3, 2011 #1
    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" [Broken]

    the Intel Core 2 Duo I am using is 64 bit, but when I run the following code

    Code (Text):
    #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",
    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.

    Last edited by a moderator: May 5, 2017
  2. jcsd
  3. Aug 3, 2011 #2


    User Avatar
    Gold Member

    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)
    Last edited: Aug 3, 2011
  4. Aug 3, 2011 #3
    Ok thanks, are the other types the expected length for 64 bit? such as float and pointer?
  5. Aug 3, 2011 #4


    Staff: Mentor

    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.
  6. Aug 3, 2011 #5


    User Avatar
    Homework Helper

    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook