Re: struct curiosity

2009-10-16 Thread pjcoup
Yes, this is basically what I expected as well. I would have expected some size that you can coax gcc to give, either 12 (as here), or 10 (with directives). Thanks to everyone for the responses! Pete On Oct 16, 4:30 am, Peter Otten <__pete...@web.de> wrote: > > I would have expected "native size

Re: struct curiosity

2009-10-16 Thread Gabriel Genellina
En Thu, 15 Oct 2009 15:07:04 -0300, pjcoup escribió: import struct struct.calcsize('BB') 11 struct.calcsize('@BB') 11 struct.calcsize(' 10 struct.calcsize('>BB') 10 I would have expected calcsize('BB') to be either 10 or 12 (padding), but 11? There are no pad bytes foll

Re: struct curiosity

2009-10-16 Thread Gabriel Genellina
En Thu, 15 Oct 2009 15:07:04 -0300, pjcoup escribió: import struct struct.calcsize('BB') 11 struct.calcsize('@BB') 11 struct.calcsize(' 10 struct.calcsize('>BB') 10 I would have expected calcsize('BB') to be either 10 or 12 (padding), but 11? There are no pad bytes foll

Re: struct curiosity

2009-10-16 Thread Mark Dickinson
On Oct 15, 7:07 pm, pjcoup wrote: > I was fooling around with python's struct lib, looking on how we'd > unpack some data.  I was a little confused by its behavior: > Python 2.5.2 (r252:60911, Jul 22 2009, 15:33:10) > [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 > Type "help", "copyright", "credi

Re: struct curiosity

2009-10-16 Thread Peter Otten
Richard Brodie wrote: > "pjcoup" wrote in message > news:b1537079-6e3a-43e1-814b-7ccf185fb...@v15g2000prn.googlegroups.com... > > >> I would have expected calcsize('BB') to be either 10 or 12 >> (padding), but 11? Is there a simple explanation of what is going >> on here? > > The purpose

Re: struct curiosity

2009-10-16 Thread Richard Brodie
"pjcoup" wrote in message news:b1537079-6e3a-43e1-814b-7ccf185fb...@v15g2000prn.googlegroups.com... > I would have expected calcsize('BB') to be either 10 or 12 > (padding), but 11? Is there a simple explanation of what is going > on here? The purpose of the padding is to align the words

struct curiosity

2009-10-15 Thread pjcoup
Hello, I was fooling around with python's struct lib, looking on how we'd unpack some data. I was a little confused by its behavior: Python 2.5.2 (r252:60911, Jul 22 2009, 15:33:10) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 Type "help", "copyright", "credits" or "license" for more information