Re: Programming question: sizeof struct?
>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
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):
__attribute__ ((packed)) struct foo
printf("%d \n", sizeof(struct foo));
This has a size of 8 without the command-line option, but 7 with it.
But this has 7 with or without:
int x __attribute__ ((packed));
And this has 7 with or without
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...)