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

David Cournapeau david at ar.media.kyoto-u.ac.jp
Thu Apr 17 04:42:42 CEST 2008


Greg Ewing wrote:
>
> Blarg. Well, I think the wording of that part of the
> standard is braindamaged. The word "byte" already has
> a pre-existing meaning outside of C, and the C standard
> shouldn't be redefining it for its own purposes.
>
> This is like a financial document that defines "dollar"
> as "the unit of currency in use in the country concerned".
> Thoroughly confusing and unnecessary.
>
> Particularly since they seem to just be defining "byte"
> to mean the same thing as "char". Why not just use the
> term "char" in the first place?
>   
They are totally different concepts: byte is not a (C) type, but a unit, 
the one returned by the sizeof operator. One char occupies one byte of 
memory, and in memory, they are the same, but conceptually, they are 
totally different, from the C point of view at least. For example, 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.

cheers,

David



More information about the Python-3000 mailing list