This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ Patch] PR 4093
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Cc: Stan Shebs <shebs at apple dot com>, Richard Henderson <rth at redhat dot com>, Jason Merrill <jason at redhat dot com>, Craig Rodrigues <rodrigc at attbi dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 03 Mar 2002 20:58:51 -0800
- Subject: Re: [C++ Patch] PR 4093
>> The big advantage is that a C parser is (close to) free, once you have
>> a C++ parser. So, you can share a whole lot of code.
>
> How would you do this? With a bunch of #ifdefs, or a bunch of if (lang
> == C)?
The latter.
In the future, I'd like to see cc1 and cc1plus be the same binary with
a switch to say whether you're compiling in C or C++.
Even if people did not want to do that, you could just make lang into
a macro, rather than a variable, and then let the compiler eliminate
the unreachable code.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com