Differences between rel1 and rel3

Christian Ludlam chris at recoil.org
Sun Sep 7 15:00:45 PDT 2003

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;

Christian Ludlam
chris at recoil.org

More information about the gcc mailing list