Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!zaphod.mps.ohio-state.edu!gem.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Zero Length Arrays Allowed in C Standard? Message-ID: <11733@smoke.BRL.MIL> Date: 2 Dec 89 07:41:21 GMT References: <2298@jato.Jpl.Nasa.Gov> <11715@smoke.BRL.MIL> <480@codonics.COM> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 20 In article <480@codonics.COM> bret@codonics.com (Bret Orsburn) writes: >In article <11715@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes: >>In article <2298@jato.Jpl.Nasa.Gov> baalke@mars.jpl.nasa.gov (Ron Baalke) writes: >>>are zero length arrays allowed in the ANSI standard for C? >>No; Standard C does not support zero-sized objects. >Aargh! Whatever happened to "don't break existing code"?! >What was the rationale behind this (IMHO) arbitrary obstruction? Many existing C compilers do not support 0-sized objects, so this is not a "change to C". K&R1 was not explicit about this and so offer no guidance; indeed, taken literally K&R1 prohibits use of the name of a 0-length array in expressions (although the C Standard fixed the thing that caused a problem there), and also permits negative constants for array lengths in declarations. There are several technical problems that would have to be overcome if 0-sized objects were allowed in C. (I don't want to discuss them in this forum.) As a proponent of zero-sized objects, I don't think these obstacles are insurmountable, but given the lack of a clear need, X3J11 decided not to open that can of worms.