Mail Archives: djgpp/1998/07/09/16:17:09
Destination: Endlisnis <s257m AT unb DOT ca>
From: Gruber Gerhard
Group: comp.os.msdos.djgpp
Date: Thu, 9 Jul 1998 15:09:53 -0300:
> If I have something like:
>struct {
> int z;
> char m;
> int a:3, b:7, c:10, d:10, e:2;
> };
>
> Where should I put "__attribute__((packed))" to make sure there is
>no 'slack-space' in that struct (especially between 'm' & 'a')? Do I have
>to put it after each variable? {a,b,c,d & e}
I'd suggest that you use char for bitfields instead. This way the compiler
creates exactly the number of bytes it needs for the bits. Even when the
number of bits are bigger then a byte.
--
Bye,
Gerhard
email: sparhawk AT eunet DOT at
g DOT gruber AT sis DOT co DOT at
Spelling corrections are appreciated.
- Raw text -