jww...@mozilla.com writes: > For > > RefPtr<T> GetFoo() { > RefPtr<T> foo; > // ... > } > > should we: > > 1. return foo and expect RVO to kick in to eliminate additional AddRef/Release > 2. return foo.forget() > 3. return Move(foo) > > Which one is preferred? > > ps: I find gcc is able to apply RVO even with "-O0". Not sure if it is also > true for other compilers.
I think the current practice is to use already_AddRefed<T> as return type and return foo.forget() Kanru _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform