C ++ typedef rule syntax

Throughout my life, I cannot find a good explanation of what rules are used to convert a typedef into a C ++ operator. Simple cases that I understand. But consider this from Danny Kalev :

typedef char * pstr;
int mystrcmp(const pstr, const pstr); //wrong!

Then Danny Kalev writes:

The sequence const pstr actually means char * const (a const pointer to char); not const char * (pointer to const char.

I cannot find a rule anywhere to explain why "const pstr" will be converted to "char * const".

Thanks for any help.

+3
source share
2 answers

, pstr char*, const pstr, const (char*), (const char)*.

+5

typedef ; . Typedef , const . , const const.

, , , const " " pstr, - . , . typedef char*** pppstr. , a char const***, const pppstr. const , , .

+3

All Articles