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: C++ PATCH: use identifier_p instead of naked TREE_CODE == IDENTIFIER_NODE


Richard Biener <richard.guenther@gmail.com> 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"

|  Then
| 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,

-- Gaby


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