Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2006-06-08 21:08:39


"Peder Holt" <peder.holt_at_[hidden]> wrote

> I tried compiling the test battery on VC8 with precompiled headers
> enabled (\Yc with test.hpp as the precompiled header) and encountered
> similar problems. Eliminating the anonymous namespaces solves the
> problem, and doesn't introduce any obvious new problems. Is there more
> than a theoretical reason for the anonymous namespaces in the first
> place? Is there any observed cases where not having anonymous
> namespaces causes corruption to typeof?

There are no observed cases, AFAIK.

However, there is also not a lot of experience. ODR is definitely violated,
one way or another. Compilers don't seem to complain about our ODR test,
but this test is designed for anonymous namespaces. I can also imagine that
some compilers may report ODR violation only in certain context. And we
never know what new [versions of] compilers will do.

It's easy to make the usage of anonymous namespace configurable by
introducing something like BOOST_TYPEOF_SUPRESS_UNNAMED_NAMESPACE. I would
also add another ODR test, targeted to this mode.

Having two possibilities may give a better chance of avoiding potential
issues with ODR. And having the mode without unnamed namespace would also
allow the user to completely avoid ODR by always registering in the same
order (having system-wide registration header), although at the expence of
dependency bottleneck.

Does this make sence?

Regards,
Arkadiy


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