This is the mail archive of the gcc@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: is_predicate_p?


Diego Novillo wrote:
> <<I personally tend to use is_foo for adjectives (e.g.,
> is_binary_expr) and foo_p for verbs (e.g., stmt_ends_bb_p).
I'd think of 'binary_expr' as a noun, and as we all know nouns
and verbs are somewhat interchangable. I would have great
difficulty with is_noun and verb_p. Are you thinking of foo
as a property the object has collected (is_noun), or as
a process it has undergone (verb_p)? They're pretty inter-
changable, why make them different?

Robert Dewar wrote:
> But the _p here seems gratuitous, stmt_ends_bb is a perfectly reasonable
> name for a predicate and reads just fine.
No. I now can't tell whether stmt_ends_bb (foo) is commanding that foo
end a statement, or questioning whether foo ends a statment.
Now sometimes it's obvious and sometimes it's not, but I think
we should have some convention to mark predicate functions, it makes
intent more obvious.

Diego Novillo wrote:
> We also have uses of _p for pointers.  If we are going to use a
> new convention I would rather get rid of _p entirely.
good point, I'd not noticed those typedefs (they appear confined
to gentype). Perhaps is_ is better because of that, and as Gaby
points out, you'll never see a naked
	is_foo ()
call, it'll always be
	if (is_foo ())
which I think is pretty damn obvious. 

I have been persuaded by the arguments that is_ is better than _p.
oh, and I was wrong, the spanish version should be is_foo_si ;-)

nathan
-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org


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