Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!utoday!comeau From: comeau@utoday.UUCP (Greg Comeau) Newsgroups: comp.lang.c++ Subject: Re: aggregate initializations Keywords: aggregates, initialization Message-ID: <1151@utoday.UUCP> Date: 13 Jan 90 00:42:02 GMT References: <974@rna.UUCP> Reply-To: comeau@utoday.UUCP (Greg Comeau, Columnist, UNIX TODAY!) Organization: UNIX Today!, Manhasset, NY Lines: 34 In article <974@rna.UUCP> kc@rna.UUCP (Kaare Christian) writes: >...C++ aggregate initializations... tremendously useful, hasn't >garnered much attention. It is omitted from most lists of "how C++ fixes >up C." Both points are generally true. >Anyway, it is obvious that the following are OK inits: >int f(int); int a = 2; int b = f(a); // URB pg 50 Absolutely. >The simple question is: does this apply to aggregates? Are the following >legal? >int c[] = { f(0), f(1), f(2) }; >struct D { int x; } d = { f(a) }; >I can't find a mention of any restriction that says aggregate >initializers must be consts, but this sort of stuff just doesn't >compile with ZTC 2.0. the DRM (Draft Reference Manual aka Ugly Reddish Book aka URB) addresses this in 8.4 and since it's not contested in 8.4.1 it's alright as well. Also const !necessarily == constant. I'm interested to see the error messages from Zortech on this. Cfront won't handle the latter cases either, probably because it requires a few special gyrations, but gives "not implemented" error messages. Does anybody know if Oregon accepts these? -- Greg, Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418 Producers of CC C++, SysAdm columnist for UNIX Today!, Microsoft Systems Journal (C programming), + others. Also, BIX c.language & c.plus.plus conf. moderator. Here:attmail!csanta!greg / BIX:comeau / CIS:72331, 3421 / voice:718-849-2355