This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: structures with zero length arrays
- From: Richard Henderson <rth at redhat dot com>
- To: Herman ten Brugge <hermantenbrugge at home dot nl>
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 8 May 2005 14:31:15 -0700
- Subject: Re: structures with zero length arrays
- References: <427E4C12.5080606@home.nl>
On Sun, May 08, 2005 at 07:27:46PM +0200, Herman ten Brugge wrote:
> So here the sizeof(s) is also 1. This looks wrong to me as well.
It's correct.
> I can not find any refence in the gcc.info file about the sizeof an
> initialized structures with zero length arrays.
See ISO C99 6.7.2.1 paragraph 16 for the definition of flexible
array members. This shows that sizeof(s) == 1.
See gcc docs for the exact semantics of the extension that allows
structures containing flexible array members to be initialized.
Notice that the semantics here do not affect the sizeof s.
r~