RFC: attribute "unpadded"
Alexandre Oliva
aoliva@redhat.com
Fri Aug 23 21:52:00 GMT 2002
On Aug 23, 2002, Mark Mitchell <mark@codesourcery.com> wrote:
> I want to create a new type attribute "unpadded" that would, on
> this code:
> struct S __attribute__((unpadded)) {
> int i;
> char c;
> };
> define S to have size 5 and alignment 4 on an ILP32 machine.
Instead of attaching this attribute to the type, perhaps it would
bring us less complications to attach it to a struct member, i.e.,
instead of:
> struct A __attribute__((unpadded)) { void *vptr; char c; };
> struct B { struct A __base; char c2; };
you'd write:
> struct A { void *vptr; char c; };
> struct B { struct A __base __attribute__((unpadded)); char c2; };
this wouldn't require any change in the typing rules, since the type
of struct A would be unchanged. The attribute would only be used to
affect the lay out of struct B. I have no idea whether this would
make the implementation of this feature much harder, though, since it
would have to peek into struct A to see how much padding it had, and
cancel that for the layout of struct B. But it sounds like a less
intrusive change in the type system.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer
More information about the Gcc
mailing list