From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22079 invoked by alias); 7 Jun 2002 21:56:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 22061 invoked by uid 71); 7 Jun 2002 21:56:02 -0000 Date: Fri, 07 Jun 2002 14:56:00 -0000 Message-ID: <20020607215602.22060.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Phil Edwards Subject: Re: c++/6945: A static constant that is initialize inline is not create if only a temperary is used Reply-To: Phil Edwards X-SW-Source: 2002-06/txt/msg00174.txt.bz2 List-Id: The following reply was made to PR c++/6945; it has been noted by GNATS. From: Phil Edwards To: spamjunk Cc: lerdsuwa@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org Subject: Re: c++/6945: A static constant that is initialize inline is not create if only a temperary is used Date: Fri, 7 Jun 2002 17:52:53 -0400 On Fri, Jun 07, 2002 at 05:27:50PM -0400, spamjunk wrote: > Not true. You can't do that when its initialized inline in the class, the > compiler will tell its that its defined twice. Incorrect; writing class Foo { static const int foo = 42; }; only provides a handy way of keeping the '42' in the header file. It does not provide a definition, only a declaration. Writing the above only means that in the ".cc" file, you can write const int Foo::foo; instead of const int Foo::foo = 42; You should either find more textbooks on C++, or buy a copy of the standard. (At $18 for a PDF it's pretty cheap, although the reading is dry.) Phil -- If ye love wealth greater than liberty, the tranquility of servitude greater than the animating contest for freedom, go home and leave us in peace. We seek not your counsel, nor your arms. Crouch down and lick the hand that feeds you; and may posterity forget that ye were our countrymen. - Samuel Adams