>#pragma pack(1) >struct {}; >#pragma pack() > >Which forces the layout to be as you specified. > >Using a command line option is a Bad Idea (tm) as it may corrupt glibc's >structures
To test a resonse to the original message, I made the follwing c file ( I was not familiar with the attribute flag, so I guessed wrong): --begin __attribute__ ((packed)) struct foo { char c[3]; int x; }; int main() { printf("%d \n", sizeof(struct foo)); } --end This has a size of 8 without the command-line option, but 7 with it. But this has 7 with or without: struct foo { char c[3]; int x __attribute__ ((packed)); }; And this has 7 with or without #pragma pack(1) struct foo { char c[3]; int x; }; #pragma pack() Which made me think... and check... and sure enough the ORIGINAL STRUCT actually has a size of 7 with the command line option! THe guy is either crazy, or he is using some strange compiler that we don't know about (althoguh he did say the size was 6, as if he had a 286...) Carl