Difference from compiler perspective between passing by const value or const ref <p>In the context of c++.</p> <p>I wonder what is the difference, between this:</p> <pre><code>T f(T const val); </code></pre> <p>and this:</p> <pre><code>T f(T const &amp; val); </code></pre> <p>I do know one is a pass by value, but, from the compiler's pespective, this is a value that is not going to change, so my questions are:</p> <ol> <li>Is the compiler still required to make a copy in the case of the const value parameter passing?</li> <li>Which one is better for the optimizer of the compiler and why?</li> </ol>