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

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Apr 17 05:00:24 CEST 2008


David Cournapeau wrote:
> They are totally different concepts: byte is not a (C) type, but a unit, 
> the one returned by the sizeof operator.

If a word is needed for this concept, then invent a new
one, e.g. "size unit", rather than reusing "byte", which
everyone already understands as meaning 8 bits.

> C impose that sizeof(unsigned type) == sizeof(signed type) for any type, 
> so if one byte is one char, unsigned char would be a byte too, and so 
> unsigned char and char would be the same, which is obviously wrong.

No, "char" and "unsigned char" can still be different types.
You just need to say that sizeof(char) == sizeof(unsigned char) == 1,
and leave bytes out of the discussion altogether.

-- 
Greg


More information about the Python-3000 mailing list