Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!wuarchive!mailrus!usenet.ins.cwru.edu!mephisto!bbn!drilex!dricejb From: dricejb@drilex.UUCP (Craig Jackson drilex1) Newsgroups: comp.lang.c Subject: Re: Zero Length Arrays Allowed in C Standard? Message-ID: <6736@drilex.UUCP> Date: 9 Dec 89 15:00:21 GMT References: <2298@jato.Jpl.Nasa.Gov> <11715@smoke.BRL.MIL> <480@codonics.COM> <8141@cg-atla.UUCP> <7349@quick.COM> <7227@ficc.uu.net> Reply-To: dricejb@drilex.UUCP (Craig Jackson drilex1) Organization: DRI/McGraw-Hill, Lexington, MA Lines: 31 In article <7227@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes: >In article <7349@quick.COM> srg@quick.COM (Spencer Garrett) writes: >> But this "convenience" is in no way implementation specific. It is >> cleanly implementable in any environment which is capable of hosting >> C at all. > >Including the infamous Burroughs A-series processors? >`-_-' Peter da Silva. +1 713 274 5180. . > 'U` Also or . I think the "convenience" referred to was the practice of putting an array of length 1 (in the absence of zero-length arrays) at the end of the structure. You may rest assured that A-Series C will handle this as well as the next compiler. Which means that if you malloc'ed the space, the malloc'ed size is what matters. The implementors of A-Series C knew that this sort of thing was rampant, and therefore implemented pointed-to objects using a simulated linear address space. They do special-case things which are not pointed to; if one declares an array: int a[1]; and *never* point to it, then referencing a[1] will get you an interrupt. Note: because of this pointed-to rule, a[1] and *(a+1) can have dramatically different compilations. -- Craig Jackson dricejb@drilex.dri.mgh.com {bbn,axiom,redsox,atexnet,ka3ovk}!drilex!{dricej,dricejb}