Struct on on x86_64 mac os x

Mark Dickinson dickinsm at gmail.com
Wed Oct 21 11:01:45 CEST 2009


On Oct 21, 9:18 am, Mark Dickinson <dicki... at gmail.com> wrote:
> On Oct 20, 10:51 pm, Tommy Grav <tg... at pha.jhu.edu> wrote:
>
> >      def read_header(cls):
> >          hdrData = "84s"*3
> >          constNData = "6s"*400
>
> I'm confused:  why is this not "400s"*6 rather than "6s"*400?
> Doesn't constName[400][6] mean 6 lots of constName[400]?
> Similarly for "84s"*3.  This might be making a difference to
> the padding.

Sorry, that's wrong.  It won't make any difference to the padding,
since arrays don't have padding in C:  sizeof(char[3]) is 3,
and sizeof(char[3][84]) is 3*84=252.

So your problem is likely just the difference between sizeof(long)
from one platform to another.

Mark



More information about the Python-list mailing list