For some reason I cannot add a const qualifier to a typedefed pointer type
if said type is used for a return value. It does work if the type is used
for a parameter.
I do not see the logic behind this, but I assume it is standard conforming
behaviour. I use GCC and I guess such an obvious "bug" (if it were one)
would have been reported and fixed long ago.
Example:
typedef char MY_CHAR;
typedef MY_CHAR * MY_STRING;
void foo(const MY_STRING str) // does work
const MY_STRING bar(void) // does not work
(GCC says the const qualifier is ignored)
if said type is used for a return value. It does work if the type is used
for a parameter.
I do not see the logic behind this, but I assume it is standard conforming
behaviour. I use GCC and I guess such an obvious "bug" (if it were one)
would have been reported and fixed long ago.
Example:
typedef char MY_CHAR;
typedef MY_CHAR * MY_STRING;
void foo(const MY_STRING str) // does work
const MY_STRING bar(void) // does not work
(GCC says the const qualifier is ignored)
Comment