$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] [CONFIG] static const definitions
From: John Maddock (boost.regex_at_[hidden])
Date: 2013-02-27 04:25:35
>> At least one other compiler does in fact require the bare definition to
>> link properly, and doesn't generate it automatically as an enhancement.
>> So I need to make these definitions conditional based on the platform
>> (and perhaps the exact compiler version?  That's why I like to use the
>> existing config knowledge base!)
>>
>> I see that Boost has BOOST_STATIC_CONSTANT  but that is for compilers
>> that don't have the in-class initialization at all.
>>
>> So if Boost is using such constructs, how does it deal with the linker
>> idiosyncrasy?
>
> You could always not initialize inline and therefore always supply a 
> separate definition.
Which would prevent them being used as constant-expressions?
In fact even when initialized inline, an out of line definition should 
always be provided as different compilers have different ideas about what 
constitutes "use" of the variable (rather than just the value).  MSVC pretty 
much never requires an out-of-line definition for example, where as GCC will 
often generate linker errors if you don't provide it.
HTH, John.