Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!jarthur!uci-ics!rfg From: rfg@ics.uci.edu (Ronald Guilmette) Newsgroups: comp.lang.c++ Subject: Re: unbounded static array member Message-ID: <25F8D83F.13456@paris.ics.uci.edu> Date: 10 Mar 90 10:34:39 GMT References: <11024@saturn.ucsc.edu> Reply-To: rfg@ics.uci.edu (Ronald Guilmette) Organization: UC Irvine Department of ICS Lines: 38 In article <11024@saturn.ucsc.edu> daniel@saturn.ucsc.edu (Daniel Edelson) writes: > >Is there or should there be a syntax for declaring a static array >member whose length is determined by the length of its initializer list? > >e.g., > > struct S > static int array[]; // Error, bound required > }; > > int S::array[] = { 1, 2, 3, 0}; That works fine using cfront 2.0! What's the problem? Oh, well! So what if it isn't documented! Next thing, you'll be wanting to have your cake and eat it too! :-) Apparently, cfront 2.0 treats declarations of static data members kind of like extern declaration of global data objects, at least to the extent that they may have incomplete (array) types (as in the example above). The thing that has been puzzling me is why, if the above example is legal, the following example is not: struct incomplete; // an incomplete type struct defined { static struct incomplete data_member; }; struct incomplete { ... }; // Ron Guilmette (rfg@ics.uci.edu) // C++ Entomologist // Motto: If it sticks, force it. If it breaks, it needed replacing anyway.