Re: Valid C++?
On Wed, 17 Oct 2007 19:00:08 +0300, Jonathan Lane
<jonathan.lane1@googlemail.com> wrote:
> [...]
>> > Clearly the "using namespace ns1" line is going to be a problem since
>> > you're polluting your ns2 namespace with the colliding names from ns1.
>> > I can understand that this is going to make ns2 contain ambiguous
>> > names.
>>
>> Normally I'd agree. However I you remove the function declaration the
>> code
>> compiles although the namespace is still polluted?
>
> presumably then the ns2 version of the struct is hiding the ns1
> version. How would you expect the compiler/your code to differentiate
> between the two structs given that they're both in scope? There's
> nothing to stop you having a function and struct/functor of the same
> name. I'd suggest it's a bit misleading to maintenance programmers but
> that's up to you of course. I guess the compiler's getting confused by
> having three conflicting names. I'm sure there's a scoping rule that
> affects this.
>
> If you won't rename the structs then at least get rid of the using
> directive in ns2. There's no need for it at all in this case and it's
> just causing you problems.
Yep, that's what I'll do. Thanks for your comments!
Boris
|