When it improves clarity, variables that are pointers to a single
object should be named with the _p
suffix. Similarly, a pointer to
a pointer to an object (also called a "handle") should be named with
the _pp
suffix when it improves clarity.
type_t *name_p, **name_pp;
This convention might be used, for example, to distinguish a one
dimensional array of pointers (void **name_p
or void
*name_p[]
) from a two dimensional array of objects (void **name
or void name[][]
), or when an object is passed directly (ie., by
value) and indirectly (ie., by reference) in the same piece of code.
When an object is always passed by reference, adding the _p
suffix does not improve clarity. Note that arrays are NOT conceptually
considered pointers, and therefore they should not be named according to
the _p
or _pp
suffix convention (unless the arrays are
arrays of pointers or arrays of pointers to pointers, respectively).
Go to the first, previous, next, last section, table of contents.