3 ms·
For the most part I agree with the article, but yes, for long functions I will often const locals that I want to make sure they stay constant (i.e. there is som
by gpderetta 5y ago
For the most part I agree with the article, but yes, for long functions I will often const locals that I want to make sure they stay constant (i.e. there is some cross variable invariant that I want to make sure always hold). I won't bother for functions of less of 10 lines (but it is not a rule and I wouldn't want it to be enforced).
I also see no issues in consting members of classes that don't have value semantics.