conrad wrote:
>
> In C, the above is a pointer to type
> "pointer to char read-only" and so
> assignments like the following
> cannot be made:
> const char **foo;
> char **baz;
> foo = baz;
>
> But in C++, I think I remember
> reading that this works.
Nope, it's the same in C and C++. Either what
you are reading is wrong or you misremember it.
You can't convert from char** to const char** because it's
not type safe.
Imagine this:
const char really_const = '?';
void f(const char*& x) {
x = &really_const; // valid: assignmetn of const
char* to const char*(reference).
}
int main() {
char* y;
f(y); // imagine the compiler let you do this (it
shouldn't).
*y = '!'; // BOOM! Just modified a really_const
}
[ Se