3 ms·
> 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
by MauranKilom 7y 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.
- gumby 7y agoIs there a language with this behavior? I would find that very confusing.