Sebastian Pipping wrote:
Joel E. Denny wrote:
I figured the namespace name is meant to be relative to the global
namespace, so a leading "::" is implicit if not specified.
I'm not sure if this is true. Could it be that without "::"
it's relative to the namespace the call was made from instead
of the global namespace?
I assume so because I had lex() in its own namespace and yylex
defined to "lex" working together before.
That is the case.
The leading part of the name (eg foo in foo::bar::baz) is looked up
using the usual lookup rules for plain identifers. The search starts in
the scope where it's used, and in subsequently enclosing namespaces
counting from the place where it's used, ultimately leading to the
global namespace if it's not found anywhere else.
When the leading part is found to be a namespace, the next part (bar) is
looked up in that.
The actual workings of qualified name lookup in C++ are pretty
complicated, especially when you start considering classes and using
declarations. Read section 3.4 "Name lookup" [basic.lookup] of the C++
standard for details.
Ciao.
Vincent.
_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison