I am tryting to compile following code with g++ (version 7.5.0)
using namespace nspace;
int main()
{
return 0;
}
It gives error as follow
$ g++ above_code.cpp
namespaces_mystery1.cpp:1:17: error: ‘nspace’ is not a namespace-name
using namespace nspace;
^~~~~~
namespaces_mystery1.cpp:1:23: error: expected namespace-name before ‘;’ token
using namespace nspace;
^
Above behaviour is what I have expected.
But when I try to compile following code, it compiles fine without error like above.
using namespace std;
int main()
{
return 0;
}
Why this different behaviour for namespace named std compared to namespace named nspace