3 ms·
const does not so much catch bugs as it prevents them. It is a way to specify a contract. If your code is const-correct, the next programmer using or maintainin
by nickelplate 16y ago
const does not so much catch bugs as it prevents them. It is a way to specify a contract. If your code is const-correct, the next programmer using or maintaining your code can read a function or method signature and know immediately which parameters will not change, or whether the object will be modified. Effective C++ explains this very well, and I fell in love with const after reading its second edition almost 10 years ago.