This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: "gimple-classes-v2-option-3" git branch committed to svn trunk as r217787
- From: Michael Matz <matz at suse dot de>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: David Malcolm <dmalcolm at redhat dot com>, Andrew MacLeod <amacleod at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 20 Nov 2014 16:34:11 +0100 (CET)
- Subject: Re: "gimple-classes-v2-option-3" git branch committed to svn trunk as r217787
- Authentication-results: sourceware.org; auth=none
- References: <1416420732 dot 3562 dot 49 dot camel at surprise> <546CEEDF dot 10007 at redhat dot com> <8C1B6C93-EAA6-4F10-84BB-743499104758 at gmail dot com> <546D0724 dot 3080006 at redhat dot com> <BF016F0D-5E76-4749-BF56-816BF9A39630 at gmail dot com> <1416435844 dot 3562 dot 78 dot camel at surprise> <CAFiYyc2pXh+sChUP91Yn3e9EF87zR7KURh6EiF7YdcThZ-2gBA at mail dot gmail dot com>
Hi,
On Thu, 20 Nov 2014, Richard Biener wrote:
> > I don't think this API will make the non-C++-fans happier; I think the
> > objection to the work I just merged is that it's adding more C++ than
> > those people are comfortable with.
>
> How so? It's already super-ugly in those views. We decided to get C++.
> Now we have it.
And? Nobody says we can't have nice looking code even with C++.
> Now please make it AT LEAST CONSISTENT.
True.
> > I suspect that any API which requires the of < > characters within the
> > implementation of a gimple pass to mean a template is going to give
> > those less happy with C++ a visceral "ugh" reaction. I wonder if
> > there's a way to spell these things that's concise and which doesn't
> > involve <> ?
>
> Only if you drop as_a/is_a/dyn_cast everywhere.
Oh god, yes. Please! IMHO they don't accomplish much, but make code
harder to visually parse. They don't accomplish much because you
have to write the snippets that check validity of conversions anyway, so
they can just as well be written as proper methods or global functions, or
even just conversion operators. Nothing forces us to implement these
snippets as noisy template specializations like:
template <>
template <>
inline bool
is_a_helper <cgraph_node *>::test (symtab_node *p)
{
return p->type == SYMTAB_FUNCTION;
}
instead of the more mundane means. And once you have those snippets as
normal functions, you can just as well call them like they are functions,
making the using side of those conversion also look nicer.
Ciao,
Michael.