This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: attribute "unpadded"
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 24 Aug 2002 01:52:49 -0300
- Subject: Re: RFC: attribute "unpadded"
- Organization: GCC Team, Red Hat
- References: <3627294541.1030124478@[192.168.0.103]>
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