Isn't return value optimization (RVO) a bug?

前端 未结 3 1637
予麋鹿
予麋鹿 2020-12-10 16:36

I maybe asking a dumb question, but I looked at the wikipedia page for RVO here and could not stop wondering if that behavior is wrong. I tried it in my machine and RVO is f

3条回答
  •  鱼传尺愫
    2020-12-10 16:45

    Define "wrong". The C++ language explicitly permits this kind of optimization even though it is observable. If the behavior of your program depends on a specific implementation, then unfortunately you are not using ISO C++, but some dialect.

提交回复
热议问题