typedef Raw pointer types are meaningless (ha!). It does not provide any real abstraction (consumers should still understand that types are pointers, and they must figure out how to parse any naming convention you use for the type name to determine what the destination type is).
This is also a bad form, because if you have:
typedef T* T_ptr;
Then const T* foo and const T_ptr bar are two different things. ( foo is a pointer to const T , the promise is not to mutate the pointer through this pointer. bar is a pointer that is const , it cannot be changed to point to something else.)
The first case (pointer-to- const ) is important: it helps conclude function contracts.
The second case is much, much less useful.
Therefore, if you need to add a typedef for a pointer type, to be useful, you need to create two:
typedef T* T_ptr; typedef const T* const_T_ptr;
A valid exception is in C ++ when you have smart pointer classes. In these cases, entering boost::shared_ptr<T> can be tedious enough that creating a typedef for it is a reasonable convenience.
source share