[Python-3000] sizeof(size_t) < sizeof(long)

Nick Coghlan ncoghlan at gmail.com
Tue Apr 15 16:14:23 CEST 2008


Trent Nelson wrote:
>> Mark Dickinson <dickinsm <at> gmail.com> writes:
>>> Fair enough.  My twisted mind was trying to find ways that size_t
>>> might be something other than long or long long, but that seems
>>> unlikely...
>> There has been a report where sizeof(size_t) < sizeof(long).
>> It breaks things in the dict implementation:
>> http://bugs.python.org/issue1646068
>>
>> < On the system I'm porting to, ints and pointers (and
>> ssize_t) are 32-bit, but longs and long longs are 64-bit. >
> 
> I wonder what system that is; sizeof(size_t) & sizeof(void *) < sizeof(long|long long) is quite peculiar, no?

I've worked on a DSP where TI were forced to define a 'byte' as 16 bits 
long because the smallest chunk of memory you could address was 16 bits 
and the C standard says that sizeof(char) == 1 byte. Fortunately most 
documentation for that chip talked about chars or MAUs (Minimum 
Addressable Units) instead of confusing everyone by actually calling the 
16-bit chunks bytes.

Anyway, once you get into chips with separate code and data buses, I can 
quite easily see configurations where the program bus is only 32-bits 
while the data bus is 64-bits.

However, so long as whatever solution you come up with can be tweaked in 
pyconfig.h (is that the right file?) to do the right thing on such odd 
platforms, it should be fine.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-3000 mailing list