Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!mephisto!utkcs2!alphard!battle From: battle@alphard.cs.utk.edu (David Battle) Newsgroups: comp.lang.c Subject: Re: Zero Length Arrays Allowed in C Standard? Message-ID: <1498@utkcs2.cs.utk.edu> Date: 13 Dec 89 20:57:35 GMT References: <2298@jato.Jpl.Nasa.Gov> <11715@smoke.BRL.MIL> <480@codonics.COM> <1989Dec2.210042.12668@twwells.com> <8129@cg-atla.UUCP <70188@psuecl.bitnet> Sender: news@utkcs2.cs.utk.edu Reply-To: battle@alphard.cs.utk.edu (David Battle) Organization: CS Dept -- University of TN, Knoxville Lines: 20 In article <70188@psuecl.bitnet> c9h@psuecl.bitnet (Charles Hannum) writes: >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. Is the order of elements of a structure guaranteed to be the same in memory as in the program? That is, given: struct foo { int a; int b; }; struct foo bar; Is &bar.a guaranteed to be < &bar.b? -David L. Battle battle@battle.esd.ornl.gov battle@utkux1.utk.edu