Mail Archives: djgpp/1996/12/10/17:39:33
Rohit Jalan <rohitj AT m-net DOT arbornet DOT org> wrote (Subject: Padding Question):-
> Is it possible to stop gcc from padding structures ?
At the top of the program put this line:-
#define pk __attribute__((packed))
Then, when you declare the struct or class, insert the word pk next before
every `;' that comes at the end of a member declaration, e.g.:-
typedef struct{long di,si,bp,res,bx,dx,cx,ax pk;
short flags,es,ds,fs,gs,ip,cs,sp,ss pk;} Regs;
class dirbuf{public:byte Reservebuf[21],attrib pk; FCBtime time pk;
FCBdate date pk; uns long size pk; char name[13] pk;
dirbuf();
byte GetFirst(char*dirname, uns int attrib=~0);
byte GetNext();
int get(char*name);};
- Raw text -