[Python-Dev] [Python-checkins] r41972 - python/branches/ssize_t/Objects/funcobject.c

Tim Peters tim.peters at gmail.com
Mon Jan 9 19:14:10 CET 2006


[Tim]
>> We could use the "I" (capital letter eye) length modifier under VC7.1.
>>  That's good for both size_t and ptrdiff_t formats under VC7.1, where
>> ptrdiff_t under VC7.1 is really the same concept as Py_ssize_t.

[Martin]
> ptrdiff_t has the advantage of being available on all platforms,
> being part of C89 (IIRC). Should we use ptrdiff_t instead of
> Py_ssize_t? Formally, ptrdiff_t could be different from size_t
> (in width); reportedly, there are 8086 compilers which had
> a 16-bit size_t (maximum size of a segment), but a 32-bit
> ptrdiff_t (allowing for cross-segment differences, something
> that apparently became undefined in C99).

I grew up on 60- and 64-bit boxes, but all I've worked on for the last
decade is 32-bit Pentium chips.  If there's a Python platform where
sizeof(size_t) != sizeof(ptrdiff_t), I don't know about it, but I'm
not sure I have a reason to _expect_ to be aware of such things
anymore.

Regardless, I like Py_ssize_t:  it clearly says "same width as size_t,
but signed".  "Difference between two pointers" is obscurely related
to that at best.


More information about the Python-Dev mailing list