Zero Length Arrays Allowed?

Daniel Elbaum dan at oresoft.uu.net
Tue Dec 5 06:19:42 AEST 1989


In article <2299 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 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)



More information about the Comp.std.c mailing list