This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Use conditional casting with symtab_node
On Fri, Oct 12, 2012 at 4:22 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> I also think that instead of
>
>>> if (cgraph_node *q = p->cast_to <cgraph_node *> ())
>
> we want
>
> if ((q = cast_to <cgraph_node *> (p))
>
> I see absolutely no good reason to make cast_to a member, given
> that the language has static_cast, const_cast and stuff. cast_to
> would simply be our equivalent to dynamic_cast within our OO model.
>
> Then I'd call it *_cast instead of cast_*, so, why not gcc_cast < >?
> Or dyn_cast <> (). That way
>
> if ((q = dyn_cast <function *> (p))
This looks fine to me.
Diego.