Re:Modern C++ for C Programmers: part 5
by BeeOnRope on Wednesday July 25, 2018 @05:51PM
(#17613217)
See my reply to the parent poster for an example where RVO applies in C++ but not C, leading to better code in the C++ case. The key is to let the address of the objects involved escape: otherwise "as if" will let C (and C++ even without RVO) optimize away the copies anyways, since they are not observable in that case.
https://godbolt.org/g/7Ewun7