Does the compiler optimize the function parameters passed by value?

Posted by Naveen on Stack Overflow See other posts from Stack Overflow or by Naveen
Published on 2010-03-15T15:57:10Z Indexed on 2010/03/15 15:59 UTC
Read the original article Hit count: 181

Filed under:
|
|

Lets say I have a function where the parameter is passed by value instead of const-reference. Further, lets assume that only the value is used inside the function i.e. the function doesn't try to modify it. In that case will the compiler will be able to figure out that it can pass the value by const-reference (for performance reasons) and generate the code accordingly? Is there any compiler which does that?

© Stack Overflow or respective owner

Related posts about c++

Related posts about compiler