Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-07-10 08:53:32


"Arkadiy Vertleyb" <vertleyb_at_[hidden]> writes:

> It turned out, however, that both these
> methods have the same problem -- they do not preserve IDs between
> compilation units, and therefore eventially leed to the ODR violation. I
> tried to work this around by using anonimous namespaces, but then David
> Abrahams proved that the ODR violation would still present in certain usage
> contexts.
>
> So I gave up, and started using manually-supplies IDs. I do realize that
> this is a significant inconvenience. Please note, however, that the IDs are
> specified on per-file rather than per-class basis (I use __LINE__ to
> distinguish inside one file).

I'm not convinced that this particular ODR violation ends up being a
problem in practice, though -- ultimately we end up getting the same
type out of any typeof(...), and if we're never generating linker
symbols within the computation performed by typeof, we're probably
going to get away with it. I think it's worth trying an automatic
scheme and stress-testing it to see if we can make it break. Better
yet, explicitly construct a pared-down version _designed_ to break
and see if we can cause a problem.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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