On Fri, Jan 8, 2010 at 2:10 AM, Albert J. Wong (王重傑) <[email protected]>wrote:
> > According to wikipedia, > http://en.wikipedia.org/wiki/Return_value_optimization, msvc, g++, and > icc, all support it...or am I missing something about this situation that > makes RVO inapplicable? > > Yes. Starting from version 3.1: http://gcc.gnu.org/gcc-3.1/changes.html > G++ now supports the "named return value optimization": for code like > > A f () { > A a; > ... > return a; > } > > > G++ will allocate a in the return value slot, so that the return becomes a > no-op. For this to work, all return statements in the function must return > the same variable > The limitation is still true AFAIK. Many compilers give up early in case where function can return two objects depending on some condition.
-- Chromium Developers mailing list: [email protected] View archives, change email options, or unsubscribe: http://groups.google.com/group/chromium-dev
