Invalid conversion from Foo** to void** - why is implicit type conversion allowed to void* but not to void**?

前端 未结 1 942
遥遥无期
遥遥无期 2020-12-20 02:25
struct Foo {};
...
void * p = (Foo*)0; // OK
void ** pp = (Foo**)0; // Invalid conversion

As far as I recall, a pointer to any non-pointer type can

相关标签:
1条回答
  • 2020-12-20 02:42

    A pointer can be implicitly cast to void * because void * is the generic pointer. However, void ** isn't the generic pointer to pointer.

    C FAQ 4.9 explains why there is no generic pointer to pointer type in C, I think it applies to C++ as well.

    0 讨论(0)
提交回复
热议问题