C++ static integer class constants...

Nathan Sidwell nathan@codesourcery.com
Mon Oct 17 09:09:00 GMT 2005


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

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



More information about the Gcc-help mailing list