This is the mail archive of the
mailing list for the GCC project.
Re: C++ PATCH: use identifier_p instead of naked TREE_CODE == IDENTIFIER_NODE
- From: Gabriel Dos Reis <gdr at axiomatics dot org>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org, jason at redhat dot com
- Date: Fri, 22 Mar 2013 07:44:00 -0500
- Subject: Re: C++ PATCH: use identifier_p instead of naked TREE_CODE == IDENTIFIER_NODE
- References: <87vc8kjdou dot fsf at euclid dot axiomatics dot org> <CAFiYyc2R406UDN=v93Dr76f8GkpvVG_boCi=ryU2QS07+Uz2BQ at mail dot gmail dot com>
Richard Biener <firstname.lastname@example.org> writes:
| > in the C++ front-end. identifier_p is effectively LANG_IDENTIFIER_CAST
| > except that it returns a typed pointer instead of a boolean value.
| Hm? So you are replacing TREE_CODE (t) == IDENTIFIER_NODE
| with kind-of dynamic_cast<identifier> (t) (in C++ terms)?
It would be a mistake to name it dynamic_cast or anything like cast (I
know it is popular in certain C++ circles to name everything xxx_cast),
because dynamic_cast is an implementation detail. I should probably
have called it "give_me_identifier_pointer_if_operand_points_to_a_cxx_identifier_object"
| naming it identifier_p is bad. We have is-a.h now, so please try to use
| a single style of C++-style casting throughout GCC.
I strongly agree with consistent style, On the other hand, isn't someone going
to object that is_xxx has a predicate connotation therefore a bad naming
because it isn't returning a bool?
I think a naming that focuses too much on implementation detail is no good,