Differences between rel1 and rel3

Jason Perry jperry at hanover-square.freeserve.co.uk
Sun Sep 7 15:15:29 PDT 2003


In message <5009682e4c.christian at venice.lab> you wrote:

> On 7 Sep Jason Perry wrote:
> 
> > From the GCC doc:
> > 
> > Here is a structure in which the field `x' is packed, so that it
> > immediately follows `a':
> > 
> >      struct foo
> >      {
> >        char a;
> >        int x[2] __attribute__ ((packed));
> >      };
> > 
> > I grepped for this particular attribute in the Unixlib headers and
> > couldn't find any examples.
> > 
> > Does this mean that this is the right way to go?
> > 
> > I tried applying it to the structure itself, with no apparent effect :-(
> 
> GCC is touchy about where attribute declarations go - you need something like
> 
> #define PACKED __attribute__((packed))
> 
> struct ch_sob {
>     struct ch_header header;
>     struct ch_time time;
>     uint8 batch;
>     uint8 clamp;
> } PACKED;
Thanks, I've tried that with no apparent effect.

Would you expect the value returned by sizeof(struct ch_sob) to be
different when using __attribute__((packed)) than when not using it?

I don't seem to be getting any reduction in size... :-(

Thanks for your suggestion.

-- 
Jason Perry
Please note: This address filters out non-plain text emails



More information about the gcc mailing list