Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!mit-eddie!apollo!vasta From: vasta@apollo.HP.COM (John Vasta) Newsgroups: comp.sys.apollo Subject: Re: trouble with cc Message-ID: <47dac4f7.20b6d@apollo.HP.COM> Date: 5 Jan 90 15:20:00 GMT References: <1047@tuvie> Sender: root@apollo.HP.COM Reply-To: vasta@apollo.HP.COM (John Vasta) Organization: Hewlett-Packard Company, Apollo Division; Chelmsford, MA Lines: 38 In article <1047@tuvie> inst182@tuvie (Inst.f.Techn.Informatik) writes: > > >Th Apollo C Compiler seems to have problems when initializing typedef'd >structures. This is especialliy disturbing when compiling X-programs, >since initializing structures becomes virtually impossible. > >Has anybody had a similar problem and found a solution ? > > Michael K. Gschwind ...!uunet!mcsun!tuvie!vlsivie!gschwind The code contains an incorrectly structured initialization list. The aggregate being initialized has four levels of structure, but the initialization list contains only three. C allows you to elide braces for the innermost level of an aggregate, but it appears that the author had elided them for the next-innermost level. The initializer list should look like this: NumberSegmentRec num_segments[12] = { { { /* this was added by me */ {0, 0, 0, 2}, /* 1 */ {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0} } /* so was this */ }, ... By the way, the AT&T 2.0 C++ translator and the GNU C compiler also complain about this code, so the Apollo C compiler is not the only one which diagnoses this error. John Vasta Apollo Computer (division of Hewlett-Packard) vasta@apollo.hp.com M.S. CHA-01-LT (508) 256-6600 x6362 330 Billerica Road, Chelmsford, MA 01824 UUCP: {decwrl!decvax, mit-eddie, attunix}!apollo!vasta