Zero Length Arrays Allowed in C Standard?

Kenneth L Moore kenmoore at unix.cis.pitt.edu
Mon Dec 4 11:34:26 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?
==>
==> Ron Baalke                       |    baalke at mars.jpl.nasa.gov 
==> Jet Propulsion Lab  M/S 301-355  |    baalke at jems.jpl.nasa.gov 
==> 4800 Oak Grove Dr.               |
==> Pasadena, CA 91109               |

If you want to find out if your C code is conservative, run lint on it.
You are much more likely to get transportable code if you do this.

Ken



More information about the Comp.lang.c mailing list