This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: structure alignement 1 byte
- To: Martin dot Heinzl at Lasertech dot at
- Subject: Re: structure alignement 1 byte
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Wed, 9 Feb 2000 22:13:08 +0100
- CC: gcc at gcc dot gnu dot org
- References: <A1621D919FB7D311AAD800104B965FF7B274@SERVER_MAIL>
> We are using the gcc 2.7.2.3 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;
}__attribute__((packed));
struct X f[2]={1,2,3,4};
Hope this helps,
Martin