[Solved] If you include const in a function, is & redundant?


Not the same. If the argument changes after it’s passed (e.g. because it’s changed by another thread), the first version is unaffected because it has a copy. In the second variant, the function called may not change the argument itself, but it would be affected by changes to y. With threads, this might mean it requires a mutex lock.

solved If you include const in a function, is & redundant?