Jonathan Brady wrote:
... I also find the following confusing:
struct.calcsize('hb')
3

struct.calcsize('hb') == struct.calcsize('bh')
False

I could understand aligning to multiples of 4, but why is 'hb' different from 'bh'?

Pad bytes have never been, as far as I know, added at the end of structs in C, only between fields, when required. So the leading "b" gets a following pad byte, but the trailing one doesn't need padding.

-Peter
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to