Does the compiler optimize the function parameters passed by value?

前端 未结 5 1795
夕颜
夕颜 2020-12-05 18:55

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 f

5条回答
  •  悲&欢浪女
    2020-12-05 19:33

    Only if the function is not exported there is a chance the compiler to convert call-by-reference to call-by-value (or vise-versa).

    Otherwise, due to the calling convention, the function must keep the call-by-value/reference semantic.

提交回复
热议问题