This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: attribute "unpadded"


On Fri, Aug 23, 2002 at 06:49:17PM +0100, Andrew Haley wrote:
> Documenting the semantics of (attribute "unpadded") and (attribute
> "aligned") and (attribute "packed") and the way that they interact in
> a way that is comprehensible to a programmer will present some poor
> soul with quite a challenge.

Maybe you want to define that in terms of internal alignment (within
the structure) and external alignment (when you put these structures
next to each other, i.e. sizeof() in practice).

Then:
- unpadded   = set external alignment to 1
- packed     = set internal alignment to 1
- aligned(n) = set internal and external alignment to n

Order matters, or unpadded/packed trump aligned.

Of course, all accessibility bets/arrays are off when
external alignment < internal alignment.

  OG.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]