المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Initializing pointer results in errors



C++ Programming
02-08-2010, 08:00 AM
I am wondering why the second and third declarations below generate errors:
const double** const example1 = new const double*[5]; // Works
// C2440: Cannot convert from 'double**' to 'const double** const'
const double** const example2 = new double*[5];
// C2059: syntax error : 'new'
const double** const example3(new const double*[5]);

void SomeFunction(const double* const * const);
// C2664: cannot convert from 'const double **const (__cdecl *)(void)' to 'const double *const *const '
SomeFunction(example3);
Why is the compiler interpreting example3 as a function pointer? Why can't a 'double**' be implicitly cast to a 'const double** const'? Thanks,Sounds like somebody's got a case of the Mondays

-Jeff