This is the mail archive of the
mailing list for the GCC project.
Re: C99 conformance bug in gcc-3.1
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- To: Fergus Henderson <fjh at cs dot mu dot OZ dot AU>
- Cc: Momchil Velikov <velco at fadata dot bg>, Tony Finch <dot at dotat dot at>, <gcc at gcc dot gnu dot org>
- Date: Fri, 31 May 2002 10:25:05 +0100 (BST)
- Subject: 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
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