Mail Archives: djgpp/1995/08/14/15:33:12
In article <DD5MGr DOT 8AE AT jade DOT mv DOT net> "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk> writes:
> If I have this struct:-
> typedef struct{char miaow; int mice_caught,birds_caught; char*name;} cat;
> and it needs to be packed, i.e. the fields starting at bytes 0, 1, 5, 9, and
> the whole struct exactly 13 bytes long with no extra bytes inserted to fill
> out to a multiple of 2 or 4, should I insert `__attribute__((packed))' after
> `cat', or before any `;' where djgpp would otherwise be tempted to insert
> filling bytes, or where?
Try:
typedef struct {
char miaow __attribute__ ((packed));
int mice_caught __attribute__ ((packed));
int birds_caught __attribute__ ((packed));
char *name __attribute__ ((packed));
} cat;
Hope that helps,
Long.
--
==============================================================
Long Doan ld AT netrix DOT com
Netrix Corporation ldoan1 AT osf1 DOT gmu DOT edu
13595 Dulles Technology Drive
Herndon Va 22071
==============================================================
- Raw text -