structure members of packed structures

Mark Mitchell mark@codesourcery.com
Tue Jul 15 10:32:00 GMT 2003


> Another question. What about
> struct __attribute__((packed)) Foo
> {
>    T m;
> };
> 
> here m happens to fall at an aligned address, and the size of Foo happens
> to be a multiple of that alignment. Should m be DECL_PACKED or not?

I say yes.

If we're going to make attributes part of the type system, then the rule
ought to be that a packed Foo packs all of its members.  On a
STRICT_ALIGNMENT system, a packed Foo * and an ordinary Foo * should be
incompatible types.

Now, how badly this breaks everything is another question...

-- 
Mark Mitchell <mark@codesourcery.com>
CodeSourcery, LLC



More information about the Gcc mailing list