This is the mail archive of the
mailing list for the GCC project.
Re: C++ static integer class constants...
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: John Ratliff <webmaster at technoplaza dot net>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 17 Oct 2005 10:09:33 +0100
- Subject: Re: C++ static integer class constants...
- References: <20051016195314.7EFB824AEF5@lax-gw02.mroute.net>
John Ratliff wrote:
On comp.lang.c++, Victor Bazarov says my example program is well-formed
standard C++ according to the ISO C++ standard.
"Since their address is never taken, the 'foo::A' and 'foo::B' are, in
fact, compile-time constant expressions that do not require storage.
The objects, therefore, don't need to be defined outside of the class
definition. g++ 3.3.3 is probably too old. It's even too old and non-
compliant in this particular case even with 1998 version of the C++
Standard. The standard was amended to allow const statics to be only
defined in the class definition if their address is not taken _even_
if they are "used" outside the class. [I am too lazy, though, to look
it up in the Standard...]" -- Victor Bazarov (comp.lang.c++)
Is this a DR? This is (a) the first time I've heard of such a change, and (b)
not mentioned in C++ TC1. Please provide a reference.
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
firstname.lastname@example.org :: http://www.planetfall.pwp.blueyonder.co.uk