const doesn't help most optimizing compilers, it only really helps prevent programmer clumsiness. Since most C/C++ compiler IR's are SSA-based all values are effectively const anyways at the level optimizations are performed whether or not they're mutable in the original source code.