Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!bellcore!faline!ulysses!hector!jss From: jss@hector.UUCP (Jerry Schwarz) Newsgroups: comp.lang.c Subject: Order of fields (Was: Arrays of Unknown Length in Structures) Message-ID: <3043@ulysses.homer.nj.att.com> Date: Tue, 29-Sep-87 14:08:07 EDT Article-I.D.: ulysses.3043 Posted: Tue Sep 29 14:08:07 1987 Date-Received: Mon, 5-Oct-87 01:45:37 EDT References: <243@mit-prep.ARPA> <1044@ius1.cs.cmu.edu> Sender: daemon@ulysses.homer.nj.att.com Reply-To: jss@hector (Jerry Schwarz) Organization: AT&T Bell Labs, Murray Hill Lines: 18 In article <1044@ius1.cs.cmu.edu> edw@ius1.cs.cmu.edu.UUCP writes: > > Let me give you a reason of why this should not be "kosher". > > I don't think it is required in C that the fields in a structure > be phyically ordered in the same ordering they are declared. But it is. The version of the ANSI standard I have at hand (slightly out of date but probably unchanged on this point) says(section 3.5.2.1): Within a structure object, the non-bit-field members and the units in which bitfields reside have addresses that increase in the order in which they declared. K&R said the same thing in different words. Jerry Schwarz