Topic: [namespace.alias] "ok" versus "error
Author: shepherd@debussy.sbi.com (Marc Shepherd)
Date: 1995/07/20 Raw View
In article 95Jul16213545@erawan.cognex.com, Michael Cook <mcook@cognex.com> () writes:
>In the DWP, in $7 [namespace.alias], paragraph 7, there is an example:
>
> namespace A {
> int i;
> }
> namespace A1 {
> using A::i;
> using A::i; // ok: double declaration
> }
> void f()
> {
> using A::i;
> using A::i; // error: double declaration
> }
>
>Why is the first "double decl" okay, but the second "double decl" is an error?
Because namespaces are an incoherent feature--full of nooks, crannies,
edge-cases, artifacts and curios that no one yet has been able to succinctly
explain. I am an enthusiastic user of C++, but continue to be amazed at
the startling number of namespace examples having perversely unintuitive
results.
---
Marc Shepherd
Salomon Brothers Inc
shepherd@schubert.sbi.com <<These are my opinions, not my employer's.>>
Author: devitto@london.sinet.slb.com (Dom De Vitto)
Date: 1995/07/21 Raw View
Marc Shepherd (shepherd@debussy.sbi.com) wrote:
> In article 95Jul16213545@erawan.cognex.com, Michael Cook <mcook@cognex.com> () writes:
> >In the DWP, in $7 [namespace.alias], paragraph 7, there is an example:
> >
> > namespace A {
> > int i;
> > }
> > namespace A1 {
> > using A::i;
> > using A::i; // ok: double declaration
> > }
> > void f()
> > {
> > using A::i;
> > using A::i; // error: double declaration
> > }
> >
> >Why is the first "double decl" okay, but the second "double decl" is an error?
Maybe because namespaces are additive ? (or maybe not..)
> Because namespaces are an incoherent feature--full of nooks, crannies,
> edge-cases, artifacts and curios that no one yet has been able to succinctly
> explain. I am an enthusiastic user of C++, but continue to be amazed at
> the startling number of namespace examples having perversely unintuitive
> results.
Yea, that too.
Dom
Author: Michael Cook <mcook@cognex.com>
Date: 1995/07/17 Raw View
In the DWP, in $7 [namespace.alias], paragraph 7, there is an example:
namespace A {
int i;
}
namespace A1 {
using A::i;
using A::i; // ok: double declaration
}
void f()
{
using A::i;
using A::i; // error: double declaration
}
Why is the first "double decl" okay, but the second "double decl" is an error?
Michael.