[PATCH INSTALLED]: delete some const shadow functions

Kaveh R. GHAZI ghazi@caip.rutgers.edu
Mon Sep 3 17:42:00 GMT 2007


On Sat, 1 Sep 2007, Tom Tromey wrote:

> >>>>> "Kaveh" == Kaveh R GHAZI <ghazi@caip.rutgers.edu> writes:
>
> >> Thanks!  But in my opinion there is no excuse for *any* "const_"
> >> shadow function.  They must all disappear.  Even if it means removing
> >> const_tree altogether.  It's just not worth the added complexity.
>
> Kaveh> You keep saying complexity, like GCC developers are too ditzy
> Kaveh> to figure this out.  Somehow they manage to understand shadow
> Kaveh> checking macros.
>
> I think the specific thing I dislike about the shadow functions is the
> code duplication.  Every shadow function means that for a class of
> changes there are two places that must be fixed.  Even when the
> functions are adjacent this can sometimes be overlooked.  That said,
> my "dislike" for this is pretty mild.

I don't like code duplication either.  Unless the function was one or two
lines, I took the common code and put it in a macro do ... while(0).
Then I issued the macro in the function and the shadow copy.  See
const_note_stores in rtlanal.c, its a poor man's template in C.  But


> Kaveh> I'm trying my best to make everyone happy.
>
> I wanted to address this but I'm not quite sure what to say...  I
> think you've been doing good work, not just with this patch series but
> over the previous years.

Well I wasn't fishing for complements, but thanks.  What I meant to convey
was that the tension between doing it "fast" per Andrew and doing it
"complete" per Diego.  You already have cheap (free) so you get to pick
one of the other two.


> Kaveh> Me too, I prefer the const shadow functions.  When we start
> Kaveh> using C++ in GCC sources I'll convert these to use function
> Kaveh> overloading.
>
> I love the "when" :-).

Yeah, in my mind it's a done deal. :-)

		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu



More information about the Gcc-patches mailing list