This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: is_predicate_p?
Nathan Sidwell <nathan@codesourcery.com> writes:
| Jason Merrill wrote:
| >
| > Predicates in GCC come in a wide variety of spellings. Some end in _p,
| > some start with is_, some have _is_ in the middle, some just expect you to
| > know they're predicates based on the meaning of the name. Should we set
| > some sort of standard spelling for future additions?
|
| I'd vote for the _p convention. FWIW I used to use the is_ convention and
| found it more awkward. I think the reason may be that with predicates
| you are asking a question, and in english you'd use a ? at the end of the
| sentance. The is_foo form looks a little like an assertion.
However, note that predicates are barely used alone. There are used
in conditional expressions and the question being asked is part of the
expression:
if (is_explicit_specialization (decl) && is_type (decl))
post_process_explicit_type_specialization (decl);
is much more readable to me as a non-native speaker (neither
English, nor LISP), than
if (explicit_specialization_p (decl) && type_p (decl))
post_process_explicit_type_specialization (decl);
But, hey:
| May be a
| spanish speaker would prefer the is_ convention (or even is_foo_p :-)
:-) :-)
-- Gaby