Florian Weimer wrote:
> Wouldn't it be more consistent to move in the other direction, and
> require that allocations of zero size fail because C does not support
> zero-sized objects?

This would be a terrible idea. In all programming domains, the special
case of 0 needs to be specified in a way that most naturally extends
the sequence of cases 1, 2, 3, ... If this is not done, application
code must constantly have special code for 0, and since programmers
are not good at doing this consistently, this would produce a large
number of bugs.

So, it is the task of the ISO C committee to *simplify* application
programming by *integrating* the case of 0 smoothly with the cases
1, 2, 3, ...

They are not entirely there yet, but the direction (e.g. of N3322)
is the correct one.

>   int a[n];
> 
> is still undefined, and that C does not support zero-sized objects in
> general?

They are working on it; they are just not there yet.

Bruno




Reply via email to