Registered: Dec, 2006
Re: Monolith: Facts, Failures, Fallacies, Falsehoods and Furphies
Posted: Dec 31, 2006 5:06 AM
> Failure: C++ syntax in general is so overloaded as to have
> big issues with ambiguity. >> in template syntax, function
> pointer syntax, enums and structs sharing namespace but
> leading to ambiguities, const correctness in
> multi-referenced pointers (eg, int * can be referenced by
> a const int *, but an int ** cannot be referenced by a
> const int **). Seemingly innocuous code can have very
> surprising results (member function template friend
What do you mean, what is the problem with multi-referenced pointers? int ** can not be referenced by a const int **, because that would break const correctness. Consider this:
int **ptr = points somewhere;
const int cInt = 5;
const int **cPtr;
cPtr = ptr; // not allowed
cPtr = &cInt // this is legal, cPtr can point to const int.
But after that, ptr points to const int which is not allowed, thus breaking const correctness.
> Failure: Too much worry about order of
> construction/destruction and object slicing.
Can you elaborate about constructors and destructors?