Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2006-04-06 13:06:16


"John Maddock" <john_at_[hidden]> wrote

> > This kind of unnamed namespace can be handled correctly by both MS
> > compilers, with respect to pch, but I don't believe it satisfies the
> > Boost naming convention. OTOH, if no other solution is found, this
> > is the only
> > way we can achieve typeof compliance with pch, while still staying in
> > the unnamed namespace.
>
> I'm surprised the any kind of unnamed namespace can be handled by PCH's:
> after all each TU should get it's own distict name for the unnamed
> namespace.

I don't know much about how this is done, but I think PCH stores the state
of the compiler, so it should be possible to leave some unknowns in this
state, such as namespace name, to resolve later. But again, I am just
speculating.

In any case, if you do somehing like this in PCH:

namespace a { namespace {
    template<class T> struct foo {};
}}

and then, outside PCH:

namespace a { namespace {
    template<> struct foo<int> {};
}}

the compiler (7.1, 8.0) will complain.

If, OTOH, you use:

namespace { namespace a {

everything seems to compile fine.

(I don't know how other compilers handle this problem, though)

Regards,
Arkadiy


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