Structure alignment problem
Fabio Giovagnini
fgiovag@tin.it
Mon Nov 4 04:54:00 GMT 2002
in my gcc-3.0.3 for sh and h8300 h s the typedef with align works poperly.
typedef struct {
unsigned char Var1;
} mystruct __attribute__((packed));
What version are you using?
Regards.
On 13:41, lunedì 4 novembre 2002, Richard Earnshaw wrote:
> > > Because you need to pack the structure as a whole, not just the members
> > > of it.
> > >
> > > Try
> > >
> > > typedef struct {
> > > unsigned char Var1;
> > > } mystruct __attribute__((packed));
> > >
> > > R.
> >
> > Tried that does not work !!
>
> Ah, yes; that's because of a long-standing bug in gcc. Separate the
> typedef from the structure declartion and it should all be fine. Ie
>
> struct mystruct {
> unsigned char Var1;
> } __attribute__((packed));
>
> typedef struct mystruct mystruct;
>
> Life is such fun...
>
> R.
>
>
> ------
> Want more information? See the CrossGCC FAQ,
> http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to
> crossgcc-unsubscribe@sources.redhat.com
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list