Comment by MauranKilom
7 years ago
> And in C++ I don't think you can prevent casting away constness.
Well, UB prevents you from doing it if the object is originally const.
My bigger gripe with the C++ (and C) const system is the lack of transitivity. A function taking a const X& may still modify e.g. the contents of an exposed pointer member of X.
Is there a language with this behavior? I would find that very confusing.