Zero Length Arrays Allowed in C Standard?

News system news at ism780c.isc.com
Sat Dec 2 09:43:32 AEST 1989


In article <2298 at jato.Jpl.Nasa.Gov> baalke at mars.jpl.nasa.gov (Ron Baalke) writes:
:
:I've inherited some C code that had the following declaration in it:
:
:     char tbi[0];
:
:When I tried to compile this using Turbo C v2.0 or VAX C, it was flagged as
:a fatal error. My question is this: are zero length arrays allowed in the
:ANSI standard for C?

No. Here is the quote from the standard of Dec 7, 1988 (page 68, line 3):

    The expression delimited by [ and ] (which specifies the size of the
    of an array) shall be an integral constant expression that has a value
    greater than zero.

I believe this one of the hot issues debated by the committee.

  Marv Rubinstein



More information about the Comp.lang.c mailing list