bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problems compiling groff with gcc-3.0.3


From: Hans Aberg
Subject: Re: problems compiling groff with gcc-3.0.3
Date: Fri, 25 Jan 2002 22:05:48 +0100

At 13:17 +0100 2002/01/25, Werner LEMBERG wrote:
>> So then it is probably the code that's old: Try to flip in a "using
>> namespace std;" somewhere appropriate.
>
>No, no, no.  Definitely bison is the culprit!  groff doesn't use *any*
>standard C++ headers or classes, so `namespace' isn't an issue at all.
>The argument `the code is old' is bad IMHO.  If the code is cleanly
>written, avoiding any problematic areas of C++ it should work with any
>C++ compiler.

The problem is that the C++ standard put all C names into "namespace std",
so when rewriting the Bison output for the C++ standard, these names end up
in "namespace std": In fact, this always happens with an up-to-date C++
compiler.

What we did is to _remove_ the addition "using <name>" that the C
compatibility .h headers of C++ add: Under current C++, there is no way to
remove a "using directive, once introduced.

A quick fix around this is to merely flip in a "using namespace std;"
somewhere appropriate if the C++ code is old, because it should then behave
as this namespace did not exist (as it defines additional global names).

So, if the idea is that the Bison output should conform to the C++
standard, this is what it should be (otherwise programs using C++
namespaces may break). Since GCC now has C++ namespaces, this comes first.

>As mentioned in another mail, 1.28 works nicely, and 1.31 seems to
>fail.

The changes were done in 1.30h+ or something.

  Hans Aberg





reply via email to

[Prev in Thread] Current Thread [Next in Thread]