Article View: comp.std.c
Article #1043Re: Zero Length Arrays Allowed?
From: Daniel Elbaum
Date: Mon, 04 Dec 1989 19:19
Date: Mon, 04 Dec 1989 19:19
22 lines
1149 bytes
1149 bytes
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)
Technical Details
Message-ID:
<1989Dec4.191942.4331@oresoft.uu.net>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!oresoft!danReferences:
<2299@jato.Jpl.Nasa.Gov>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!oresoft!dan From: dan@oresoft.uu.net (Daniel Elbaum) Newsgroups: comp.std.c Subject: Re: Zero Length Arrays Allowed? Message-ID: <1989Dec4.191942.4331@oresoft.uu.net> Date: 4 Dec 89 19:19:42 GMT References: <2299@jato.Jpl.Nasa.Gov> Reply-To: dan@oresoft.uu.net (Daniel Elbaum) Organization: Oregon Software, Portland, OR Lines: 22