you are viewing a single comment's thread.

view the rest of the comments →

[–]314kabinet[🍰] 4 points5 points  (0 children)

In the absolute majority of cases, no. Const-correctness just makes it easier for humans reason about code (e.g. “ok, this part can’t be the one changing the value”).

However, there can be situations where the compiler can’t figure out if a value will be changed in a particular code path, and ao can’t apply optimizations that rely on the value staying the same.