----Original Message---- >From: Shaun Jackman >Sent: 02 August 2005 20:26
> On 8/2/05, Paul Koning <[EMAIL PROTECTED]> wrote: >> One of the things that continues to baffle me (and my colleagues) is >> the bizarre way in which attributes such as "packed" work when applied >> to structs. >> >> It would be natural to assume, as Shaun did, that marking a struct >> "packed" (or, for that matter, "packed,aligned(2)") would apply that >> attribute to the fields of the struct. > > This is exactly the behaviour suggested by the info docs: > > $ info gcc 'C Ext' 'Type Attr' > ... > Specifying this attribute for `struct' and `union' types is > equivalent to specifying the `packed' attribute on each of the > structure or union members. > There are two separate issues here: 1) Is the base of the struct aligned to the natural alignment, or can the struct be based at any address 2) Is there padding between the struct members to maintain their natural alignments (on the assumption that the struct's base address is aligned.) I think this is where some of the ambiguity in the docs comes from. But I'm about to leave the office now, so I can't go into depth with this thread right now.... cheers, DaveK -- Can't think of a witty .sigline today....