Steve McIntyre <[EMAIL PROTECTED]> wrote: > >> And just in case you are wondering, I ran all those previous tests again > >> with -std=c99 with exactly the same results. > > > >Thank you for the test! > > > >So GCC is in clear violation with the C-99 standard. > > Which part of the C-99 standard, exactly? Section 6.7.2.1, paragraph > #12,#14,#15 (see draft N869 from > http://cbfalconer.home.att.net/download/n869_txt.bz2) says the > following: > > --------------------------------------- ... > [#15] As a special case, the last element of a structure > with more than one named member may have an incomplete array > type. This is called a flexible array member, and the size > of the structure shall be equal to the offset of the last > element of an otherwise identical structure that replaces > the flexible array member with an array of unspecified > ---------------------------------------
> i.e. there may be no padding before the first member of a structure, > but there may be elsewhere within the structure including right at the > end. As a special case, if you specify the last member of your > structure as a "flexible array member" then there will be no padding > _at the end of the structure_. It does not affect padding _within_ the > structure. > > I'm sorry, I don't see anything here to support your assertion that > gcc is behaving incorrectly. Could you please run a final test? I would like to see the offset of "dummy" in the structure (e.g. via the offsetof() macro from <stddef.h>). I am sure that GCC will _not_ introduce padding _before_ "dummy" and the C-99 stanad requires that sizeof (struct test) == offsetof(struct test, dummy); Jörg -- EMail:[EMAIL PROTECTED] (home) Jörg Schilling D-13353 Berlin [EMAIL PROTECTED] (uni) [EMAIL PROTECTED] (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily