Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!cs.utexas.edu!yale!cmcl2!rna!kc From: kc@rna.UUCP (Kaare Christian) Newsgroups: comp.lang.c++ Subject: aggregate initializations Keywords: aggregates, initialization Message-ID: <974@rna.UUCP> Date: 11 Jan 90 14:41:03 GMT Organization: Rockefeller University - Neurobiology Lines: 22 By chance, I've just come across another lawyerly question. Naturally I've consulted the usual suspects to come up with a clear understanding of what's what, but haven't had much luck. The topic, C++ aggregate initializations. From various sources (Stroustrup, Lippman, The Ugly Reddish Book) it is obvious that C++ initializations are much more flexible that C's. This capability, while tremendously useful, hasn't garnered much attention. It is omitted from most lists of "how C++ fixes up C." Anyway, it is obvious that the following are OK inits: int f(int); // URB pg 50 int a = 2; int b = f(a); 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. Kaare Christian kc@rna.rockefeller.edu ...cmcl2!rna!kc