Thursday, December 3, 2009

What in_lto_p has _p suffix in GCC 4.5

Abstract: Curiosity killed the cat XD

Usually we use _p suffix to pointers in C language, but it is not the case for in_lto_p in GCC 4.5, so I searched for the reason, and according to <http://www.stanford.edu/~blp/writings/blp-stds/blp-stds_4.html> :

p-convention
A _p suffix indicates a boolean test for the condition described by the rest of the name. (This comes from Lisp.)

And it can be supported by this wiki page<http://en.wikipedia.org/wiki/P_convention> :

This practice originated among users of the Lisp programming language, in which there is the convention of appending the letter “P” on elements to denote a predicate (a yes or no question). It is most commonly used at MIT and the University of California, Berkeley, or among computer scientists working in Artificial intelligence (which frequently uses Lisp).

So _p for predicate not pointer here :)

No comments:

Post a Comment