RVO and named RVO are both allowed by the standard. They are not REQUIRED by the standard, no optimizations of any kind are REQUIRED by the standard.That's about return values, not parameters, though.
I've posted my opinions on it in this thread (I don't want to copy+paste the large-ish post).
Regarding your post on that other thread, you claim that the compiler will use move semantics in a situation where a caller passes a (local?) value as a function parameter and doesn't use that value afterwards. I see how the compiler has a chance to optimize in this situation, but does the standard actually guarantee the compiler will do so? I don't remember reading about such a thing before. It seems like a potentially very expensive and difficult thing for the compiler to detect reliably under all conditions.
Show differencesHistory of post edits
#ActualWashu
Posted 01 November 2012 - 04:01 AM
#1Washu
Posted 01 November 2012 - 04:01 AM
RVO and named RVO are both allowed by the standard.That's about return values, not parameters, though.
I've posted my opinions on it in this thread (I don't want to copy+paste the large-ish post).
Regarding your post on that other thread, you claim that the compiler will use move semantics in a situation where a caller passes a (local?) value as a function parameter and doesn't use that value afterwards. I see how the compiler has a chance to optimize in this situation, but does the standard actually guarantee the compiler will do so? I don't remember reading about such a thing before. It seems like a potentially very expensive and difficult thing for the compiler to detect reliably under all conditions.