[Gc] gc7 and 64-bit platforms
Richard A. O'Keefe
ok at cs.otago.ac.nz
Tue Nov 16 15:06:50 PST 2004
MenTaLguY <mental at rydia.net> wrote:
What platform and compiler is this? I'm fairly certain that, according
to the language specification, sizeof(size_t) =3D=3D sizeof(void *)...
Don't be certain of it, because the language specification says no such thing.
And it couldn't, because in some compilation modes on MS-DOS it wasn't true.
Size_t has to be big enough to hold the size of the largest object you can
allocate. In some MS-DOS compilation modes, pointers were 32 bits, but each
object had to fit in a single segment, which meant that size_t was 16 bits.
Then consider AS/400, where pointers were huge (128 bits)
but size_t was 32 bits. On AS/400, there was *no* integral type the same
size as a void*.
Or consider the PRIME computers, where pointers were 48 bits, but there
was no 48-bit integral type.
We're not even guaranteed that ptrdiff_t is big enough to hold a void*.
C99 added intptr_t and uintptr_t, or was going to. I don't know what
they decided to do about machines like AS/400 and PRIME where pointers
were bigger than any hardware integer type.
More information about the Gc