(e-mail address removed) wrote:
Is char** (or char*[]) implicitly convertible to 'const char * const
*'?
You put this in parentheses like they're equal types. They're not.
No, but char*[] is implicitly convertable to char **.
I couldn't find anything about it in the standard. MSVS 8.0 allows
this. I'm curious if I'll run into trouble with other compilers like
GCC though.
The answer is no, these implicit conversions are not allowed. An
explicit cast is required. From the FAQ:
http://www.eskimo.com/~scs/C-faq/q11.10.html.
I'd like to know the justification for this. Is there or might there
be a system on which const pointers have a different representation
than non-const ones?
You (and that FAQ) seem to think that a cast would work, and would
not cause undefined behavior, which makes me think that the
constraint is entirely spurious, and only exists to force people to
type needless casts. If there's a legitimate case for not allowing
it to implicitly convert, then a cast, too, would cause undefined
behavior (like trying to cast int ** to void **)
Also, i was certain there was a table in the rationale document that
implied this was allowed - maybe it was in POSIX.