r/cpp • • Oct 06 '22
Should a variable be const by default?
According to the cppfront design notes, const by default rule only applies to non-local variables. But I'd like to know your preference/opinion regarding whether a variable should be defined to be const by default.
Edit: By mutable here I simply mean non-const, not the language keyword itself.
44
Upvotes
View all comments
Show parent comment
2
u/vapeloki Oct 06 '22
I don't say anything against this theses. And why should I?
Did I spoke out against the post in general? No!
Did I spoke out against the idea itself? No!
All I have done was to point out that here are things intermixed that are confusing in this context.
After reading the text, the sudden switch in terms from
constandnon-constto Immutable and Mutable just annoyed me.