Problem with 'struct' module
nospam at here.com
Tue Jun 14 16:37:12 CEST 2005
On Tue, 14 Jun 2005 14:24:56 -0000, Grant Edwards <grante at visi.com>
>Your example is not using standard alignment. It's using
> By default, C numbers are represented in the machine's native
> format and byte order, and properly aligned by skipping pad
> bytes if necessary (according to the rules used by the C
> Alternatively, the first character of the format string can
> be used to indicate the byte order, size and alignment of
> the packed data, according to the following table:
> Character Byte order Size and alignment
> @ native native
> = native standard
> < little-endian standard
> > big-endian standard
> ! network (= big-endian) standard
> If the first character is not one of these, "@" is assumed.
> Native byte order is big-endian or little-endian, depending
> on the host system. For example, Motorola and Sun
> processors are big-endian; Intel and DEC processors are
> Native size and alignment are determined using the C compiler's
> sizeof expression. This is always combined with native byte
> Standard size and alignment are as follows: no alignment is
> required for any type (so you have to use pad bytes); short is
> 2 bytes; int and long are 4 bytes; long long (__int64 on
> Windows) is 8 bytes; float and double are 32-bit and 64-bit
> IEEE floating point numbers, respectively.
> Note the difference between "@" and "=": both use native
> byte order, but the size and alignment of the latter is
Thanks. I clearly missed the point of the explanation...
There is no virtue in believing something that can be proved to be true.
More information about the Python-list