Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2004-05-27 10:14:21

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. :)

And FWIW it's IMHO irrelevant here anyway as we are trying to create a
workaround for a compiler bug. The generic (and presumably correct) code
is not touched, we just add a #ifdef'ed something which simply works -
whether or not it's standard conformant. And I think we've already seen
worse bugs and workarounds already :-D

Regards, Daniel

Daniel Frey
aixigo AG - financial solutions & technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web:

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