4 ms·
> In C/C++, making almost every variable const at initialization is good practice. I wish it was the default, and mutable was a keyword. I know it's irrelevant
by omnicognate 1y ago
> In C/C++, making almost every variable const at initialization is good practice. I wish it was the default, and mutable was a keyword.
I know it's irrelevant to his point, and it's not true of C, and it doesn't have the meaning he wants, but the pedant in me is screaming and I'm surprised it hasn't been said in the comments:
In C++ mutable is a keyword.
- tsimionescu 1y agoIt's also really funny, since C++ is like a malicious genie with this. The author wished for mutable to be a keyword, and C++ made the wish come true: it's a keyword that removes some of the guarantees of const!