Zero Length Arrays Allowed in C Standard?

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Dec 1 11:06:32 AEST 1989


In article <2298 at jato.Jpl.Nasa.Gov> baalke at mars.jpl.nasa.gov (Ron Baalke) writes:
>are zero length arrays allowed in the ANSI standard for C?

No; Standard C does not support zero-sized objects.

I'm POC for a zero-sized object special interest group,
but frankly there has been little activity since the
committee's consensus was clearly against such objects.

You might consider changing the [0]s to [1]s and where
the allocation/pointer trickery occurs in the code
making an adjustment for the additional byte in the
object type.



More information about the Comp.lang.c mailing list