Strange problem with structs Linux vs. Mac
Martin Blume
mblume at freesurf.ch
Sun Mar 16 13:45:19 EDT 2008
"sturlamolden" schrieb
>
> > This seems to imply that the Mac, although running now
> > on Intel processors, is still big-endian.
>
> Or maybe the struct module thinks big-endian is native
> to all Macs? It could be a bug.
>
Dunno, I'm on thin ice here. Never used a Mac.
Maybe the underlying C library thinks that all Macs are
big-endian?
I don't think this qualifies as a bug, but I am astonished
that the struct module does not tell you whether you are
big endian, you have to find out yourself with
struct.unpack('@I', s)[0]==struct.unpack(">I", s)[0]
Anyway, when handling binary data across machines, I think
it is proper to explicitly specify the endian-ness and to
do sanity-checking of the results.
Regards
Martin
More information about the Python-list
mailing list