Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-05-27 17:45:55

Daniel Frey <daniel.frey_at_[hidden]> writes:

> Jonathan Wakely wrote:
>>>To my best knowledge even with the inclass line
>>>static const int value = true ;
>>>you have to give a definition outside of the class:
>>>int A::value;
>> Only if A::value is "used in the program". Stroustrup says if you
>> use it in
>> a way that requires the object to be stored in memory, e.g take its address
>> AFAICT you don't need to give an out-of-class definition if the
>> value is only
>> used in integral constant expressions. Is that right?
> Not quite. In practice, you are right, but the standard requires
> *exactly* one definition for all static data members. See 9.4.2/5. So,
> while Franz is right in theory, you are right in practice. :)

Actually you're all wrong. Or right. There's a Core DR on this one.
The vacpp behavior will become nonconforming when that DR is official.
It may already be so; I'm not sure if it went into TC1 or not.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at