Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2007-06-14 16:40:23


on Thu Jun 14 2007, "Arkadiy Vertleyb" <vertleyb-AT-hotmail.com> wrote:

> "Richard Day" <richardvday_at_[hidden]> wrote
>
>> Basically if boost is striving for header only libraries when ever
>> possible(And that is my impression)
>
> I don't think this is 100% correct. In my impression Boost is a combinatiom
> of libraries produced by different people (or different groups of people).
> Each library author has his/her only preference regarding splitting the code
> between headers and source files.
>
>> should there be unnamed namespace's
>> being used at all ?
>
> The main problem of unnamed namespaces in headers is the possibility of ODR
> violation. Has anyone seen any compiler complain about this? In Typeof
> library we specifically implement test cases to cause ODR violation (because
> we do use unnamed namespaces in headers; only since they are hidden inside
> macro definitions, we don't get inspection complains). No compiler
> complains of any ODR so far.

I'm less worried about ODR being diagnosed than I am about undiagnosed
ODR violations causing code to misbehave. The effects could be
subtle, like two identical specializations of the same function
template ending up with different addresses. The linker could refuse
to merge them because the body of the generated code is different,
which would have happened because the two identical specializations
used different instances objects from unnamed namespaces (e.g. _1).

So I'm not convinced that testing to see if the compiler complains is
enough.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com
The Astoria Seminar ==> http://www.astoriaseminar.com

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