Re:Why Const Doesn't Make C Code Faster
by Kranar on Monday August 19, 2019 @07:08PM
(#20742567)
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.
[ Parent
| on HN ]
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++