Mail Archives: djgpp/1993/03/24/19:29:52
>Can I force djgcc to pack structures? I'm reading headers of ZIP and other
>archive files, and these do not have fields nicely aligned. In the EMX
>documentation, I found #pragma pack(1), but this doesn't seem to do anything
>to djgcc.
You have to pack the structure elements as needed in gcc 2.2.2. I do not know
about 2.3.x.
#ifdef __GNUC__ /* HJB/POHC */
#define PACKED __attribute__ ((packed));
#else
#define PACKED
#endif
struct s_attach {
short result;
ulong conhan PACKED;
};
This will make sizeof(struct s_attach) == 6 rather then 8.
Peter Crowley
Quarterdeck Offices Systems
pcrowley AT qdeck DOT com
- Raw text -