T
Tim Rentsch
My own rule of thumb is to never create a typedef name for an object
pointer type, unless that type is meant to be opaque and never
dereferenced directly.
I'd like to offer another case for consideration.
It makes sense to use typedef to define a type name for an object
pointer type when the pointed-to type is supposed always to be
allocated in the heap and never as a regular (either static or auto)
variable. This rule can work especially well with struct's:
typedef struct {
/* ... yada, yada, yada... */
} *Yada;
Since there is no name for the 'struct' type itself, it can never be
used accidentally to declare a local variable that's an instance of
the struct; this can avoid certain kinds of programming errors.