I would use pointer typedefs only in situations where the nature of the pointer of the resulting type does not matter. For example, the typedef of a pointer is justified when you want to declare an opaque type "handle", which is simply implemented as a pointer, but should not be used by the user as a pointer.
typedef struct HashTableImpl *HashTable;
In the above example, a HashTable is a “handle” for a hash table. First, the user will get this descriptor from a function, say CreateHashTable and pass it, say, to a HashInsert function and the like. The user does not have to care (or even know) that the HashTable is a pointer.
But in cases where the user must understand that the type is actually a pointer and can be used as a pointer, pointer typedefs significantly confuse the code. I would avoid them. Declaring pointers explicitly makes the code more readable.
It is interesting to note that the C standard library avoids such typedefs. For example, FILE is obviously intended to be used as an opaque type, which means that the library could define it as typedef FILE <some pointer type> , instead of forcing us to use FILE * all the time. But for some reason, they decided not to.
source share