How far do you go with const
? Do you just make functions const
when necessary or do you go the whole hog and use it everywhere? For example, imag
"const is pointless when the argument is passed by value since you will not be modifying the caller's object."
Wrong.
It's about self-documenting your code and your assumptions.
If your code has many people working on it and your functions are non-trivial then you should mark "const" any and everything that you can. When writing industrial-strength code, you should always assume that your coworkers are psychopaths trying to get you any way they can (especially since it's often yourself in the future).
Besides, as somebody mentioned earlier, it might help the compiler optimize things a bit (though it's a long shot).