baalke@mars.jpl.nasa.gov (Ron Baalke) (12/01/89)
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 and 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@mars.jpl.nasa.gov
Jet Propulsion Lab M/S 301-355 | baalke@jems.jpl.nasa.gov
4800 Oak Grove Dr. |
Pasadena, CA 91109 |dan@oresoft.uu.net (Daniel Elbaum) (12/05/89)
In article <2299@jato.Jpl.Nasa.Gov> baalke@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 and 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. The intent of the original coder would most likely be
satisified by
char tbi[]; /* incomplete type; size to be filled in later */
or
char tbi[1]; /* maybe at the end of a structure template */
.
--
The disbelievers say: "Lo! This is a mere wizard." -Quran, Surah X
({uunet,tektronix,reed,sun!nosun,osu-cis,psu-cs}!oresoft!(dan)@oresoft.uu.net)