[PATCH 0/6] Conversion of gimple types to C++ inheritance (v3)

Jeff Law law@redhat.com
Tue Nov 5 22:17:00 GMT 2013


On 11/05/13 14:57, David Malcolm wrote:
>
> Thanks for looking through this.
>
> Both you and Andrew objected to my use of the is-a.h stuff.  Is this due
> to the use of C++ templates in that code?   If I were to rewrite things
> in a more C idiom, would that be acceptable?
I can't speak for Andrew, but my experience with this kind of object 
type casting in a large C++ project is that it's a red flag for a design 
problem.

You could certainly argue that the design problem already exists.  You 
could further argue that what you're doing is marking those warts 
visible in the code rather than in the data structures.  Whether or not 
that's a good thing I haven't pondered much.

For me personally it's less about the syntax.  Others may have other 
opinions.  I strongly suggest they chime in with them ;-)

>
> Maybe.  If the above idea is still too far, we could keep the
> GIMPLE_CHECK checking, and cast by hand.  I suspect the results would be
> more ugly (though it's clear that beauty is in the eye of the beholder
> here :))
>
> BTW, how do you feel about static_cast<> vs C-style casts?
Dislike them both :-)

jeff



More information about the Gcc-patches mailing list