r/cpp • u/[deleted] • 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.
Oct 08 '22
1419
Immutable by default
706
Mutable by default
44
Upvotes
2
u/vapeloki Oct 06 '22
Yes, nothing wrong with this take. But we are not talking about a new language, and OP used language keywords in the text of this post. So what is your argument?
I'm talking about this post, not about theoretical concepts of a C++ evolution