A bug in struct module on the 64-bit platform?
Neal Norwitz
nnorwitz at gmail.com
Thu Dec 1 00:51:08 EST 2005
ahn1 at llnl.gov wrote:
> Hi,
>
> I have a user who complained about how "struct" module computes C
> struct data size on Itanium2 based 64-bit machine.
I wouldn't be surprised, but I don't understand the problem.
> >>struct.calcsize('idi')
> 16
> >>struct.calcsize('idid')
> 24
> >>struct.calcsize('did')
> 20
These are what I would expect on a 32 or 64 bit platform. i == int, d
== float. ints are typically 4 bytes on 64 bit platforms. If you want
8 byte integers, you typically need to use longs (format letter is ell,
l).
You didn't say which version of python, so it's possible this was a bug
that was fixed too.
On my system:
python: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for
GNU/Linux 2.4.1, dynamically linked (uses shared libs), not stripped
>>> struct.calcsize('l') #that's a lowercase ell
8
If you think it's a bug, you should file a bug report on source forge.
n
More information about the Python-list
mailing list