[PATCH INSTALLED]: delete some const shadow functions

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Sun Sep 2 20:06:00 GMT 2007


> I do not care for CONST_CAST either.  It's also hideous and offers no
> benefits.  However, I guess I can learn to tolerate it.
> 
> +  /* This CONST_CAST is okay because last_stmt doesn't modify its
> +     argument and the return value is not modified.  */
> +  const_tree stmt = last_stmt ((basic_block)CONST_CAST(bb));
> 
> Apologies for appearing so obstinate here, but I really dislike
> this approach.

I agree with you.

As I said before, I think it's a good thing for the programmer to put into
the code, rather than just comments, as much about variables as is
practical to put there based on considerations of language and other
things.  That's why we have alignments as "unsigned int" rather than "int":
we're saying they can't be negative.  Saying something is constant is also
a useful declaration to a reader.  These (especially "unsigned") might
cause *slight* performance improvements of the compiler, but the main
motivation for them is to make the code easier to *read* by declaring the
intent of the programmer.  However, if what's needed to do to make them
work is to add too much "hideous" code, it *doesn't* make it easier to
read, thus leaving no reason for putting it there and reasons for *not*
putting them there.



More information about the Gcc-patches mailing list