I have read numerous times that enforcing const-correctness in your C or C++ code is not only a good practice with regards to maintainability, but also it may allow your compiler to perform optimizations. However, I have read the complete opposite, too — that it does not affect performance at all.
Therefore, do you have examples where const correctness may aid your compiler with improving your program's performance?
See Question&Answers more detail:os