This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]