This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C99 conformance bug in gcc-3.1


On Fri, 31 May 2002, Fergus Henderson wrote:

> But, on the other hand, the ability to put zero-sized array members in
> structs or arrays is something that GNU C has supported for years.
> I think it would be undesirable to prohibit that now.
> 
> Furthermore, it would be odd for zero-sized array members to behave
> differently than flexible array members.  (Is that what you are arguing
> for?)

Zero-sized array members *do* behave differently from flexible array
members.  Zero-sized members can occur in the middle of structures,
whereas we disallow this for flexible array members.  We only allow (as an
extension) static initialization of flexible array members - users wanting
that had to change their code from zero-sized arrays to flexible array
members.  So it's natural to continue this by implementing the various
other constraints (as unconditional hard errors, not pedwarns) for
flexible array members only.

In any case, the whole point of this feature is to fill out the array to
an indeterminate length, which can't be done when the structure is in an
array - so putting them in arrays is of doubtful utility whichever version
of the feature is used.

glibc uses the different variant features in its headers (depending on
compiler version) as if they are compatible, so some care is needed in
working out whether an ABI change to fix the layout for flexible array
members would affect the structures used by glibc.

-- 
Joseph S. Myers
jsm28@cam.ac.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]