Note that
typedef int* intptr;
const intptr x;
is not the same as:
const int* x;
intptr
is pointer to int. const intptr
is constant pointer to int
, not pointer to constant int
.
so, after a typedef pointer, i can’t make it const to the content anymore?
There are some ugly ways, such as gcc’s typeof macro:
typedef int* intptr;
intptr dummy;
const typeof(*dummy) *x;
but, as you see, it’s pointless if you know the type behind intptr
.