[Python-Dev] ssize_t: ints in header files

"Martin v. Löwis" martin at v.loewis.de
Tue Jun 6 20:04:56 CEST 2006


Jim Jewett wrote:
> Martin v. Löwis replied:
> 
>> ... column numbers shouldn't exceed 16-bits, and line #s
>> shouldn't exceed 31 bits.
> 
> Why these particular numbers?
> 
> As nearly as I can tell, 8 bits is already too many columns for human
> readability.

There isn't a practical 8-bit integer type in C, so the smallest integer
you can get is "short", i.e. 15 resp. 16 bits. For line numbers, 65536
seems a little too restrictive, so 31 bits is the next-larger type.

> If python is being used as an intermediate language (code is
> automatically generated, and not read by humans), then I don't see any
> justification for any particular limits, except as an implementation
> detail driven by convenience.

Precisely so. The main point is that we should set a limit, and then
code according to that limit. There is no point to use a 64-bit integer
for code size constraints.

Regards,
Martin



More information about the Python-Dev mailing list