
Daniel Frey <daniel.frey@aixigo.de> 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 http://www.boost-consulting.com