Path: utzoo!attcan!uunet!husc6!bloom-beacon!oberon!orion.cf.uci.edu!uci-ics!glacier.ics.uci.edu!schmidt From: schmidt@glacier.ics.uci.edu (Doug Schmidt) Newsgroups: comp.lang.c++ Subject: Re: static members Message-ID: <3381@paris.ics.uci.edu> Date: 8 Jan 89 03:29:25 GMT References: <701@cadillac.CAD.MCC.COM> <1354@cod.NOSC.MIL> Sender: news@paris.ics.uci.edu Reply-To: Doug Schmidt Organization: University of California, Irvine - Dept of ICS Lines: 47 In article <1354@cod.NOSC.MIL> mball@cod.nosc.mil.UUCP (Michael S. Ball) writes: >In article <701@cadillac.CAD.MCC.COM> rpj%cad@MCC.COM (Rich Johns) writes: >> c) a static const data member CAN have an initial value. > >Only the default value of zero. > I was under the impression ( after reading some postings here and from experimenting with cfront 1.2 ) that a static const data member CAN have an initial value. As proof by existence ;-), try this out on cfront 1.2.1: ---------------------------------------- class foo { public: static const int i = 100; int a [ i ]; foo ( ) { ; } }; main ( ) { foo f; printf ( "elements in f.a = %d\n", sizeof f.a / sizeof *f.a); // should print out 100 } ---------------------------------------- > >All of these answers apply to existing implementations of the language >(cfront 1.2 ore equal). There were discussions of ways to change them >at the USENIX workshop, so they should not be considered the last word. > I hope that this working example is not just a fluke, but is rather either a part ( or soon to be a part ) of the official definition of the language. Any comments? Doug -- schmidt@ics.uci.edu (ARPA) | Per me si va nella citta' dolente. office: (714) 856-4043 | Per me si va nell'eterno dolore. | Per me si va tra la perduta gente. | Lasciate ogni speranza o voi ch'entrate.