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: [PATCH 00/89] Compile-time gimple-checking


Hi,

On Fri, 25 Apr 2014, Richard Biener wrote:

> Btw, I agree we should stick to one style throughout the code-base.
> The advantage of the cast variant is that it can be made work with
> NULL pointers (in the dyn_cast <> case).

NULL pointers shouldn't even be casted at all, there should be sensible 
early-outs or conditions to avoid work on NULL.

> Oh, and you could avoid all the base-class changing stuff if you'd
> do the method like
> 
> class Foo
> {
>   template <class T> T *as () { return as_a <T> (this); }
> }
> 
> Best (or worst) of both worlds.
> 
>   gimple_cond c = g->as<gimple_cond> ();
> 
> ;)  (you can even put those methods in a separate feature class you
> can simply inherit from)

Yeah, well, I can write ugly C++ as well, it's just that I don't want to 
:-/


Ciao,
Michael.


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