Loading...

gcc@gcc.gnu.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: What does zero-length array mean at file scope? Dave Korn Mon May 25 03:01:18 2009

Andrew Haley wrote:

>>>   Obviously I can't see for looking; can you please point me to the precise
>>> chapter/page/paragraph/line that I should have found earlier?
> 
> "Zero-length arrays are allowed in GNU C.  They are very useful as the
> last element of a structure ..."
> 
> That doesn't in any way imply that the last element of a struct is the only
> circumstance in which you may use a zero-length array.

  *boggle* Yes, I must have been tired!  I repeatedly scanned that as

"Zero-length arrays are allowed in GNU C [ ... eyes or perhaps brain go blurry
about here ... ] as the last element of a structure which is really a header
for a variable-length object"

> Yes.  That's what is usually done: all you have to do is fix the back end.

  :) Just to be helpful, I added a few extra words to the documentation for
ASM_OUTPUT_COMMON in my revised patch.

http://gcc.gnu.org/ml/gcc-patches/2009-05/msg01545.html

    cheers,
      DaveK