c++ - Const pointer and pointer to const -
instead of doing this:
int* const p;
and this:
const int* p;
couldn't make easier read doing:
typedef int* ptr; const ptr p; //constant pointer integer
and:
typedef const int ptr; ptr* p; //pointer constant integer
there's no reason that. not make code less readable, doesn't make sense.
typedef const int ptr;
^ makes no sense - const int call pointer. save , readers , type out
const int* ptr;
edit:
to directly answer question: no, not make easier.
edit #2
another point, happens when have
typedef const int ptr; typedef const long ptr; typedef const float ptr;
not not make sense, since aren't pointers, have bunch of things called ptr, , confused writing.
Comments
Post a Comment