fundamental / rtosc

Realtime Safe OSC packet serialization and dispatch
https://fundamental-code.com/wiki/rtosc/
MIT License
85 stars 16 forks source link

Enable return value optimization #49

Closed JohannesLorenz closed 3 years ago

JohannesLorenz commented 3 years ago

Fix warning: "moving a local object in a return statement prevents copy elision [-Wpessimizing-move]".

return x and return std::move(x) is the same for a local x, but the latter makes RVO impossible.

fundamental commented 3 years ago

It took a few google searches to confirm (and a few minutes of a google dev talk), but you're 100% right. I just misunderstood some of the C++ standard when it came to std::move() and g++ is right to raise the warning. Curiously clang doesn't yet emit a warning on my system.