有人能解释一下为什么第二个转换是允许的,而第一个不允许吗?它们都可能允许修改const左值...
double *wPtr;
const double ** wRef = &wPtr;
const double * const * wRef = &wPtr;
谢谢,regu。
添加来自Comeau的编译错误...
int main( int argc, const char* argv[] )
{
double *wPtr;
const double ** wRef = &wPtr;
return 0;
}
Compiling Comeau C/C++ 4.3.10.1 (Oct 6 2008 11:28:09) for ONLINE_EVALUATION_BETA2
Copyright 1988-2008 Comeau Computing. All rights reserved.
MODE:strict errors C++ C++0x_extensions
"ComeauTest.c", line 4: error: a value of type "double **" cannot be used to
initialize an entity of type "const double **"
const double ** wRef = &wPtr;
^
1 error detected in the compilation of "ComeauTest.c".