I’m looking at LPSTR which is defined as
typedef char* PSTR, *LPSTR;
The documentation says that PSTR is an alias for LPSTR. Is the fact that the dereference operator is missing enough to tell me it’s an alias? How are alias’s declared? In other words if I change this to
typedef char* PSTR, PSTR2, *LPSTR;
Do I now have two alias’s? What if I add another dereferenced variable?
typedef char* PSTR, *LPSTR, *LPSTR2;
Nothing is missing. The whitespace around the asterisk doesn’t matter.
This:
is the same as
which in turn is the same as having
Both define type alisaes for the type “pointer to
char“, but there is no connection between them, the fact that they’re both declared with the sametypedefdoesn’t matter much, is mostly done when you want variants (with and without pointer) like so:this, by the way, is a practice I really discourage (as is the code in the question itself), since “hiding the asterisk” is generally a bad idea. That asterisk matters, and having it present instead of being hidden in the type makes the code much clearer.