[Python-Dev] PEP 296 - The Buffer Problem

Oren Tirosh oren-py-d@hishome.net
Thu, 25 Jul 2002 06:01:58 -0400


On Thu, Jul 25, 2002 at 09:45:44AM +0200, Thomas Heller wrote:
> > >> 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)?

The obvious type to index byte arrays would be ptrdiff_t.

If (char*)-(char*)==ptrdiff_t then (char*)+ptrdiff_t==(char*)

	Oren