Message95510
> Just for clarification, why does "ci" get padded but "ic" doesn't?
Because no padding is necessary in the second case: both the integer and
the character already start at a position that's a multiple of 4---the
integer at position 0 and the character at position 4.
In the first case, without padding, the integer wouldn't start at a word
boundary.
The aim is to make sure that the byte sequence output by struct.pack
matches the layout of a corresponding C struct. In the first case inter-
item padding is necessary to make that work, in the second it isn't.
You could argue that in the second case, Python should add trailing
padding, but I'm not sure what the point would be. |
|
Date |
User |
Action |
Args |
2009-11-19 19:10:22 | mark.dickinson | set | recipients:
+ mark.dickinson, eric.smith, sgk284 |
2009-11-19 19:10:21 | mark.dickinson | set | messageid: <1258657822.0.0.604907120759.issue7355@psf.upfronthosting.co.za> |
2009-11-19 19:10:20 | mark.dickinson | link | issue7355 messages |
2009-11-19 19:10:20 | mark.dickinson | create | |
|