Hi All,
I am having two executable one is a 32 bit compiled version and other is 64 bit compiled version. I was in assumption the size of integer for 32 bit will be 2 ^32 and size of 64 bit compiled version will be 2 ^ 64. But in my case both are showing 2 ^32 I mean I am not able to go over size of 2 ^32. Any clarification will be helpful
Thanks
Arun
cd
to /usr/include
Two header files - limits.h and stdint.h have everything the compiler can know about integer sizes in bits, usually WORD_BITS
and CHAR_BITS
are used to define the rest of the macros.
You may have some compiler options to control long int
size, I do not know.
Start with that. BTW you should have tried to read these and some other header files just to get an idea about what settings your compiler can and does employ.
There should be/is a man page for each of the important header files like math.h
You assumption was wrong.
Most 64 bit platforms (Windows, Linux, Solaris, AIX, HP-UX, MacOS, BSD, ...) have selected the LP64 data model, meaning an integer (i.e. an int in C) is still 32 bit while only long and pointers are 64 bits. This page explain why this was preferred against the various possible alternatives.
1 Like