M
mihai
Hi,
I have a question regarding the conversion (in c or c++) from char**
to const char**.
The fallowing code refuses
to compile with g++ (and others):
char **p;
const char **q = static_cast<const char**>(p);
or, exact the same situation:
void f(const char **p) {}
int main() {
f(p);
return 0;
}
And I don't understand why. It should work because is a conversion for
a non const pointer to a const pointer.
Thank you,
Mihai.
I have a question regarding the conversion (in c or c++) from char**
to const char**.
The fallowing code refuses
char **p;
const char **q = static_cast<const char**>(p);
or, exact the same situation:
void f(const char **p) {}
int main() {
f(p);
return 0;
}
And I don't understand why. It should work because is a conversion for
a non const pointer to a const pointer.
Thank you,
Mihai.