[fprint] 4000b image error

Timo Teras timo.teras at iki.fi
Fri Nov 9 06:37:42 PST 2012


On Fri, 9 Nov 2012 17:29:09 +0300 Vasily Khoruzhick
<anarsoul at gmail.com> wrote:

> On Fri, Nov 9, 2012 at 5:19 PM, Timo Teras <timo.teras at iki.fi> wrote:
> > On Fri, 9 Nov 2012 17:08:16 +0300 Vasily Khoruzhick
> > <anarsoul at gmail.com> wrote:
> >
> >> That could be an alignment issue, could you guys try attached
> >> patch? At least it should not break anything.
> >
> > It should not be. The structure is aligned properly - though adding
> > the packed attribute is probably a good idea.
> 
> I mean structure fields alignment.
> sizeof() and offset of fields could differ on different platforms if
> you do not specify "packed" attribute
> explicitly

Yes, but it depends on your structure. This happens only if the fields
are not aligned to architecture specific minimum required alignment.

I have there only 8-bit and 16-bit wide fields, and the 16-bit wide
ones are 16-bit aligned. According to current C standards this would be
always returning the same layout.

But yes, the packed attribute is useful to add, so the reader
understands that the structure is actually a wire format structure. And
also to make sure the compiler won't try anything "too smart".

- Timo


More information about the fprint mailing list