Re:What's wrong with C++ (from the point of view of someone ...
by jpr on Sunday July 18, 2010 @01:20PM
(#1526165)
I'm not sure what you mean, since current compilers already warn if you write that code.
[ Parent
| on HN ]
Re:What's wrong with C++ (from the point of view of someone ...
by jhg on Sunday July 18, 2010 @05:59PM
(#1526846)
Hmm, OK. Try a different example - the compiler should allow the following code without any warnings:
void foo(int * a) { }
void bar(int * b) { foo(b); }
void baz(const int * c) { bar(c); }
Point being is that the compiler should warn of the const violation based on whether a function argument or a class member is getting touched in the function code.In fact, the example above is more relevant, because what I am ultimately aiming for is to not need to make member functions const, and yet be able to call them for const class instances.