[Python-Dev] PEP 296 - The Buffer Problem

Thomas Heller thomas.heller@ion-tof.com
Thu, 25 Jul 2002 09:45:44 +0200


> [Scott Gilbert]
> > At the moment, the only 64 bit platform that I have easy access to is
> > Tru64/Alpha.  That version of malloc takes a size_t which is a 64 bit
> > quantity.
> >
> > I believe most semi-sane platforms will use a size_t as argument for
> > malloc,
> 
[Tim]
> That much is required by the C standard, so you can rely on it.
> 
> > and I believe most semi-sane platforms will have a size_t that is
> > the same number of bits as a pointer for that platform.
> 
> The std is silent on this; it's true on 64-bit Linux and Win64, so "good
> enough".
> 
> >> Can you index these byte arrays by longs?
> 
> > You could index it via a long, but using a LONG_LONG is safer.  My
> > understanding is that on Win64 a long will only be 32 bits even though
> > void* is 64 bits.
> 
> Right.

So isn't the conclusion that sizeof(size_t) == sizeof(void *) on
any platform, and so the index should be of type size_t instead of
int, long, or LONG_LONG (aka __int64 in some places)?

Thomas