Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!husc6!seismo!mcnc!rti-sel!dg_rtp!meissner From: meissner@dg_rtp.UUCP Newsgroups: comp.lang.c Subject: Re: Initialization of a two-dimen. array of structures. Message-ID: <1497@dg_rtp.UUCP> Date: Mon, 23-Mar-87 09:24:42 EST Article-I.D.: dg_rtp.1497 Posted: Mon Mar 23 09:24:42 1987 Date-Received: Wed, 25-Mar-87 03:54:14 EST References: <2173@ncoast.UUCP> <340@slovax.UUCP> Reply-To: meissner@dg_rtp.UUCP (Michael Meissner) Distribution: comp Organization: Data General (Languages @ Research Triangle Park, NC.) Lines: 31 In article <340@slovax.UUCP> michael@slovax.UUCP (Michael Longe) writes: (original example deleted, you've seen it before) > .... It compiled okay with the addition of another level of > matching {}: > > stuff[20][30] = { > { > {"joe", 1, 0, 12}, > {"fred", 1, 0, 13}, > {"carol",1, 0, 4} } > } > > K&R p. 124 says, for a particular example, "... It would be more precise > to enclose initilizers for each 'row' or structure in braces, ... but the > inner braces are not necessary when the initializers are simple variables > or character strings, and when all are present." > > Apparently some compilers prefer the inner braces. It doesn't hurt to have > them in either case. The technical reason the compilers are spilt on this issue seems to be the way the compilers are implemented. Compilers implemented via top-down recursive descent (ie, the original Ritchie PDP-11 C compiler, MANX, etc.) will accept the minimal braces, wheras bottom up LALR based compilers (the Johnson PCC compiler in particular) have difficulty with this. The draft ANSI standard says it is implementation defined what happens if you have left some intermediate level of braces off. -- Michael Meissner, Data General Uucp: ...mcnc!rti-sel!dg_rtp!meissner It is 11pm, do you know what your sendmail and uucico are doing?