This is the mail archive of the
mailing list for the GCC project.
Re: Zero-length arrays
On 04-Jan-2001, Linus Torvalds <firstname.lastname@example.org> 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)
I've argued against that rule at length in comp.std.c/c++,
and while I still don't agree with the decision to keep the rule,
I am at least familiar with the arguments for its retention.
One argument is that using it breaks code which does
int array_size = sizeof(array)/sizeof(array);
Another argument is that it breaks the invariant that every object
has a unique address.
Fergus Henderson <email@example.com> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.