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: ANSIfy cp/parser.c




--On Friday, January 10, 2003 01:33:08 PM +0100 Gabriel Dos Reis <gdr@integrable-solutions.net> wrote:

Well, I do believe that the "code duplication" issue is a realistic
and killer argument.  We have datapoints showing how that beats us in
the past (and present).  However, wouldn't it be possible to set up
machinery to share codes between those front-ends?
The problem with the c-common strategy is that we have to keep trying
to refactor code that doesn't need to be refactored -- just reused.

As a small example, consider the C++ code that handles variables going
out of scope.  It checks for a destructor, and if there is one, runs
a cleanup.  Well, that will work fine in C -- there are no destructors.
If profiling shows those checks to be expensive, conditionalize the
function.  But, there's no reason to use function-pointers and callbacks
and so forth to move most of the code into c-common.

Declarators are perhaps a better example.  If we really do create a
sensible declarator data-structure there's no point putting it in
c-common, and then having lots of shared code for processing them, but
then extra bits for C++ constructs like qualified names and
pointers-to-members.  The right thing to do is simply to use the same
code, but not check for qualified names or pointers-to-members in C.

--
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]