Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!codonics!bret From: bret@codonics.COM (Bret Orsburn) Newsgroups: comp.lang.c Subject: Re: Zero Length Arrays Allowed in C Standard? Message-ID: <556@codonics.COM> Date: 8 Dec 89 20:27:26 GMT References: <2298@jato.Jpl.Nasa.Gov> <11715@smoke.BRL.MIL> <480@codonics.COM> <8141@cg-atla.UUCP> <7349@quick.COM> Reply-To: bret@codonics.UUCP (Bret Orsburn) Organization: Codonics, Inc., Middleburg Heights, OH Lines: 27 In article <7349@quick.COM> srg@quick.COM (Spencer Garrett) writes: >How would you deal with the following? > > struct blat { > struct blat *next; > int value; > char name[0]; > } *new; >If you >declare it "char name[1]" then there's no portable way to get the >size of the header (since you can't predict how much padding may >need to be added). Sorry if I am missing some subtlety here, (if so, I have probably edited out the meat of it) but it seems pretty clear to me that the padding bytes should exist in the zero-length case as well. Otherwise, the array "name" is not legally aligned. -- rn: go away -- ------------------- bret@codonics.com uunet!codonics!bret Bret Orsburn