gcc align.

RenWei renwei@huawei.com
Wed Nov 8 03:42:00 GMT 2000


hi ,
   i want  to use __attribute__ ((aligned(x)))
  on some  pIII , RedHat 6.2 box.
my problem is:
1.
  i use this

 struct {
        char a ;
         unsigned short b;
         char c;
} me __attribute__((aligned(4))) ;

and
 struct {
        char a ;
         unsigned short b;
         char c;
} me2;

i print the size of me and me2,  but their size is the same .  I want  me
align in 4 bytes, how to get it?

2.
i want all the struct in some c file  align in 4 bytes,  but if i use
__attribute__, it only works in one struct.

how can i  do this in gcc ?

thanks
                                renwei.



More information about the Gcc mailing list