Mail Archives: djgpp/1999/03/03/01:42:47
On Tue, 2 Mar 1999, Shadow Seeker wrote:
> >If you need to minimize this padding (e.g., if your program uses large
> >arrays of such structs, where padding will waste a lot of memory), lay
> >out structures so that the longer members are before the shorter ones.
> No, that won't do, I can't design the structs, I read datafiles that
> use them. But Endlisnis gave me a clue that works perfectly.
>
> Just add "__attribute__(packed)" behind the struct and things work
> just fine.
It's "__attribute__((packed))" (double parentheses).
This is all explained in the FAQ, btw.
- Raw text -