Re: Size of C/C++ data type from GNU GCC/g++ compiled ELF 64-bit LSB executable, AMD x86-64 vs. ELF 32-bit LSB executable, Intel 80386

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tom peng wrote:

> Are those 32-bit / 64-bit difference stipulated in C/C++ standard or ruled
> by the GNU/GCC compiler?

All the standard says is that sizeof(short) <= sizeof(int) <=
sizeof(long), it doesn't give any actual numbers, other than
sizeof(char) = 1.  The choice of what the particular values are is
defined by the platform's ABI specification, not gcc.  gcc just follows
the spec for each platform.

It's very broken to assume that sizeof(long) is 4, because that is not
true on almost any 64 bit platform, the major exception begin Windows
x64.  It's especially broken considering that the C99 standard gives you
the header <stdint.h>, which provides int32_t, uint32_t, int64_t,
uint64_t, and so on.

Brian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux