qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Stitcher <astitc...@redhat.com>
Subject Re: C++ namespaces and 'using' question
Date Thu, 11 Sep 2008 04:18:20 GMT
On Wed, 2008-09-10 at 12:13 -0400, 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;

I believe the intent of this code is "using qpid::framing", and the code
author got a little confused!

> 
> ...
> 
> 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:
> 
> using qpid::framing;
> 
> Or
> 
> using namespace qpid;
> 
> With code as is today, apparantly VC is trying to find "framing"
> within "qpid::framing", but not use "qpid::framing" itself.
> 
> I don't know C++ language and verse well enough to say what's right
> with any authority, but I believe MSVC is right here (and I think the
> Solaris compiler did the same thing). So far this sort of thing has
> been fixed by prepending qpid:: to the method signature (in the
> example above).

I'm not 100%, but I think you're correct that g++ is too lenient here -
the best place to test this is on the dinkumware website using the edg
compiler.

> ...
> How does this sound? I can put a jira for this as well, if it merits
> further discussion, but I don't want to get into a code format war.

On the whole I don't feel all that strongly about it, but I tend to
think that being more explicit is better so I'd prefer to see:

using qpid::framing;
using qpid::sys;
etc.

in the files that merit it, rather than a blanket:
using namespace qpid;

Andrew



Mime
View raw message