structure alignement 1 byte

Martin v. Loewis
Wed Feb 9 13:22:00 GMT 2000

> We are using the gcc on a SuSE linux system installed on a intel pc.
> We need structure alignment 1 byte bounary.
> Which compilerflag have to be set to get 1 byte alignment ?
> Can you help me?

The -fpack-struct is the flag that gives that feature. Please note
that it affects *all* structures, including those defined in the C
library. So if you want to run the programs on Linux, the option is
not useful. Instead, you should set the alignment on a per-structure
basis, such as

struct X{
  int i;
  char c;

struct X f[2]={1,2,3,4};

Hope this helps,

More information about the Gcc mailing list