Boost logo

Boost :

From: Martin Bonner (Martin.Bonner_at_[hidden])
Date: 2007-06-01 04:18:57


----Original Message----
From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]] On Behalf Of Andy Sent: 31 May
2007 18:43 To: boost_at_[hidden]
Subject: Re: [boost] [guid] - review results? - inline missing

> "Martin Bonner" <Martin.Bonner_at_[hidden]> wrote in
> news:5D8503D66B71984E8D7F6651BA74D0592E0071_at_yew.PS.LOCAL:
>
>> From: boost-bounces_at_[hidden] on behalf of Peter Dimov
>> Sent: Thu 31/05/2007 18:04
>> To: boost_at_[hidden]
>> Subject: Re: [boost] [guid] - review results? - inline missing
>>
>> Hartmut Kaiser wrote:
>>> You need to add an explicit 'inline' specifier to any function
>>> defined out of class but in a header, regardless if it's a
>>> templatized function or not.
>>
>> I don't think that this is true.
>> ________________________________
>>
>> <end quote>
>> Why don't you think this is true?
>>
>> If you have the same function defined in two translation units
>> (because it is dragged into both via #include), it's a violation of
>> the One Definition Rule unless the definitions have inline.
>>
>
> < snip >
>
> I don't know what is correct by the standard, or what is correct to do
> to ensure that all comilers will be able to compile it.
>
> But, I included uuid.hpp (from uuid_v9.zip that I just uploaded to the
> vault) in two different complication units (and called some of the
> templated functions). The templated functions do not have the inline
> keyword and I don't get a complication error using visual studio .NET.

See my other post (executive summary, Peter is right and I was wrong),
but not getting a compilaton error is not much evidence. The normal way
that violations of the ODR manifest themselves is with a linker error,
or unexpected behaviour at runtime because what the programmer thought
was a single object has ended up in two places.

-- 
Martin Bonner
Project Leader
PI SHURLOK LTD
Telephone: +44 1223 441434 / 203894 (direct)
Fax: +44 1223 203999
Email: martin.bonner_at_[hidden]
www.pi-shurlok.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk