Zero-length arrays

Richard Henderson rth@redhat.com
Thu Jan 4 10:54:00 GMT 2001


On Thu, Jan 04, 2001 at 10:37:44AM -0800, Linus Torvalds wrote:
> (I never understood why C had that silly "you can't have a zero-length
> array" rule. Even if there were no real reasons to use them, it still
> has a clear and unambiguous conceptual meaning)

Mostly because they are petrified of objects with zero length, I think.

Not without reason -- they can cause much pain.  I havn't thought about
all the ways things can fail, but have run into a couple in playing
around.  None serious enough that I thought it absolutely necessary that
we restrict zero-length arrays to otherwise non-empty structures, but
nevertheless the stance gcc is going to have to take in such edge cases
is Don't Do That.


r~


More information about the Gcc mailing list