A bug in struct module on the 64-bit platform?
Fredrik Lundh
fredrik at pythonware.com
Thu Dec 1 12:35:27 EST 2005
jepler at unpythonic.net wrote:
> This is the case on my linux/x86_64 machine:
> $ python -c 'import struct; print struct.calcsize("idi")'
> 20
> I don't know much about 'itanium', but i'd be surprised if they
> chose 4-byte alignment for doubles.
oops. missed your reply.
> http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,180,00.html
fwiw, the same applies to HP-UX:
http://devresource.hp.com/drc/STK/docs/refs/64concepts.jsp
maybe this is a Windows issue?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win64/win64/storing_a_64_bit_value.asp
I couldn't find anything on alignment, but maybe it's the LLP64 model
that's messing things up for the struct module? running the following
snippet with different values for TYPE might help us figure this out:
#define TYPE char // try short, int, long, float
typedef struct { TYPE c; double x; } st_double;
main() {
printf("align = %d\n", (sizeof(st_double) - sizeof(double)));
}
</F>
More information about the Python-list
mailing list