3 ms·
> In C return value optimization is not a problem to begin with of course it is - https://gcc.godbolt.org/z/welWvd https://gcc.godbolt.org/z/welWvd C gives yo
by jcelerier 7y ago
> In C return value optimization is not a problem to begin with
of course it is - https://gcc.godbolt.org/z/welWvd https://gcc.godbolt.org/z/welWvd
C gives you O(N) memcpy, C++ gives you O(1) do-stuff-in-place for the exact same code
> overloading operators
has exactly zero things to do with RVO
> I don't feel like any of this is consistent or simpler than C.
it produces vastly simpler user code. In years and years of programming in C++ never has "code acts differently depending on whether it's return value optimized or not" been an issue for anyone I know.