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: structures with zero length arrays


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~


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