[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: %prefix with C++ namespaces
From: |
Joel E. Denny |
Subject: |
Re: %prefix with C++ namespaces |
Date: |
Wed, 3 Oct 2007 23:05:05 -0400 (EDT) |
On Tue, 2 Oct 2007, Hans Aberg wrote:
> > Given this comment and given our discussion about how wrapping parser.cc
> > in a namespace probably won't ever work
Well, I was wrong about that. I tried this:
namespace foo {
#include "parser.cc"
}
Now I see that it's actually pretty easy to work around the compilation
problems. Just #include all standard library headers before the above
code.
> > , I think we agree that the leading
> > "::" is redundant where Bison uses the user-supplied namespace to generate
> > a namespace declaration. That is, the outermost namespace is always the
> > global namespace.
>
> Right. Until somebody finds a well motivation for otherwise :-).
So, I guess my opinion is flipping again because I now see a potential
motivation. In scenarios like the above, the namespace declarations
generated by Bison in parser.cc are *not* rooted at the global namespace,
and the code compiles fine.
> I suggest don't worry about it: in references, keep it as the user enters it.
Agreed. In the above scenario, relative references to symbols in the
namespace might be necessary, and Bison shouldn't convert them to absolute
references. In other scenarios, the user may need to add the leading "::"
if he uses Bison-generated references in a different scope.
- Re: %prefix with C++ namespaces, Hans Aberg, 2007/10/01
- Re: %prefix with C++ namespaces, Joel E. Denny, 2007/10/01
- Re: %prefix with C++ namespaces, Hans Aberg, 2007/10/01
- Re: %prefix with C++ namespaces, Joel E. Denny, 2007/10/02
- Re: %prefix with C++ namespaces, Hans Aberg, 2007/10/02
- Re: %prefix with C++ namespaces, Joel E. Denny, 2007/10/02
- Re: %prefix with C++ namespaces, Hans Aberg, 2007/10/02
- Re: %prefix with C++ namespaces,
Joel E. Denny <=
- Re: %prefix with C++ namespaces, Hans Aberg, 2007/10/04
- Re: %prefix with C++ namespaces, Akim Demaille, 2007/10/03
- Re: %prefix with C++ namespaces, Hans Aberg, 2007/10/03