K
Kira Yamato
Just curious. Does the C++ standard say anything about reusing the
same identifier for variables/class names/function names?
I tried this under g++4.0.1:
class a {};
class b {};
a b; // no problem here.
b c; // compiler complains "error: 'b' does not name a type"
class b c; // but no problem now if I use the keyword 'class'.
void a() {} // no problem here.
int main()
{
a e; // compiler complains "error: 'a' does not name a type
class a e; // but this is ok.
a(); // no problem here.
return 0;
}
same identifier for variables/class names/function names?
I tried this under g++4.0.1:
class a {};
class b {};
a b; // no problem here.
b c; // compiler complains "error: 'b' does not name a type"
class b c; // but no problem now if I use the keyword 'class'.
void a() {} // no problem here.
int main()
{
a e; // compiler complains "error: 'a' does not name a type
class a e; // but this is ok.
a(); // no problem here.
return 0;
}