amd64: why is sizeof(int) =4? why not =8?
Hi,
I wanted to find out more about amd64, so I installed the debian distro
(etch/sid) on my amd64 dual core system.
I wanted to see if it is really 64 bit. So naively i compiled the following
example program I found on the internet:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct employee_st {
char name[40];
int id;
} Employee;
int main()
{
int myInt;
Employee john;
printf("Size of int is %d\n",sizeof(myInt));
/* The argument of sizeof is an object */
printf("Size of int is %d\n",sizeof(int));
/* The argument of sizeof is a data type */
printf("Size of Employee is %d\n",sizeof(Employee));
/* The argument of sizeof is a data type */
printf("Size of john is %d\n",sizeof(john));
/* The argument of sizeof is an object */
printf("Size of char is %d\n",sizeof(char));
printf("Size of short is %d\n",sizeof(short));
printf("Size of int is %d\n",sizeof(int));
printf("Size of long is %d\n",sizeof(long));
printf("Size of float is %d\n",sizeof(float));
printf("Size of double is %d\n",sizeof(double));
return 0;
}
and the output is no different from on my 32 bit system.
ie:
Size of int is 4
Size of int is 4
Size of Employee is 44
Size of john is 44
Size of char is 1
Size of short is 2
Size of int is 4
Size of long is 8
Size of float is 4
Size of double is 8
So how do I see the 64 bittness of the operating system if not this way with
gcc? I would think tha size of int would be 8?
uname -a
Linux Rashi 2.6.16.1-meshulum-2006-4-5 #1 SMP Wed Apr 5 13:34:46 EDT 2006
x86_64 GNU/Linux
Thanks,
Mitchell Lks
Reply to: