Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!psuvax1!psuvm!psuecl!c9h From: c9h@psuecl.bitnet Newsgroups: comp.lang.c Subject: Re: Zero Length Arrays Allowed in C Standard? Message-ID: <70188@psuecl.bitnet> Date: 6 Dec 89 22:21:05 GMT References: <2298@jato.Jpl.Nasa.Gov> <11715@smoke.BRL.MIL> <480@codonics.COM> <1989Dec2.210042.12668@twwells.com> <8129@cg-atla.UUCP Lines: 29 > <1989Dec5.112553.24087@twwells.com> <11963@phoenix.Princeton.EDU> <8141@cg-atla.UUCP> <11759@smoke.BRL.MIL> Organization: Engineering Computer Lab, Pennsylvania State University Lines: 25 In article <11759@smoke.BRL.MIL>, gwyn@smoke.BRL.MIL (Doug Gwyn) writes: > > The main problem is that two distinct 0-length objects might have > the same address. This bothers some people. In *most* compilers, a 0-length array would share the same address as the next data item defined after it. However, you should not rely on this, because it may be non-portable. It seems that the main reason (and *only* even half-way decent reason) for using a 0-length array is to allocate a variable amount of memory for a structure depending on the length of the array. This seems reasonable. However, as usual, some compilers try to protect the dumb, stupid, idiotic, crazed, terminal-bashing, cpu-smashing programmer from making such a stupid mistake. (BTW: I'm being sarcastic.) Hell, C doesn't do any other array bounds checking; why should it bother me about something like this? As far as I'm concerned, your compiler is broken. -- - Charles Martin Hannum II "Klein bottle for sale ... inquire within." (That's Charles to you!) "To life immortal!" c9h@psuecl.{bitnet,psu.edu} "No noozzzz izzz netzzzsnoozzzzz..." cmh117@psuvm.{bitnet,psu.edu} "Mem'ry, all alone in the moonlight ..."