Cast away const. One of the many reasons I gave up on C++.
What is const if it can be cast away?
back
1 comments
const should have been renamed to readonly, because that's what it means. It means that a variable only has readonly access to a value, but it is possible that another variable has write permissions, and so a compiler can not assume that just because one variable has readonly permission, that all variables have readonly permission except for in very limited circumstances.
readonly was the original proposed name, if I remember my D&E [0] correctly. Bjarne outlined in that book why he went with const instead, but I forget why off the top of my head. I guess it's tine for a re-read!
[0] The Design and Evolution of C++
const values are really const (i.e. immutable). Const references are actually readonly. Could have used different keywords of course.