On Wed, 2008-09-10 at 20:45 -0400, Carl Trieloff wrote:
> Steve Huston wrote:
> > Hi,
> >
> > In working on the Windows port, I've come across a few places where
> > there's C++ using-directives such as:
> >
> > using namespace qpid::framing;
> >
> > ...
> >
> > int MyClass::Method (framing::Buffer &b)
> > ...
> >
> > g++ is ok with this construct, but Microsoft Visual C++ complains that
> > framing is unknown. Essentially, what VC wants is either:

g++ would not be ok with that unless you also have a 

using namespace qpid;

or MyClass is defined inside the qpid namespace.

I suspect the issue is that when you have:

namespace qpid { namespace broker { framing::Foo x; }}

gcc is checking all the surrounding namespaces (qpid::broker:: and
qpid::) but MSVC is checking only the exact current namespace
(qpid::broker::)

Not sure which is correct.

> >
> > using qpid::framing;
> >
> > Or
> >
> > using namespace qpid;
> 
> I think this one is the way to go and the correct per c++  -- andrew y/n?
> 
> using namespace qpid;
> 
> But we should make sure it works across all the complier options we support.
> 
> Carl.

That's correct but a bit draconian. I suspect the issue you describe can
be resolved by either:
 1. adding an extra using namespace qpid; which is easy.
 2. Removing all un-necessary namespace prefixes - if you have using
namespace qpid::framing then you can just remove all the framing::
prefixes.

I also don't want to get into a format war, but before we propose a rule
that causes a reformat of the entire codebase I'd like to be sure we
have identified the least painful fix. Adding extra using statements or
removing redundant prefixes is much easier than adding prefixes to every
un-prefixed identifier in every file that has such a using statement.

Cheers,
Alan.

Reply via email to