←back to thread

498 points azhenley | 2 comments | | HN request time: 0.448s | source
1. omnicognate ◴[] No.45769837[source]
> 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.

replies(1): >>45770361 #
2. tsimionescu ◴[] No.45770361[source]
It'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!