RVO is always applied, if possible. For your case, if myFunction1 () does not return different named objects depending on the execution path, the compiler should execute RVO. If it returns different named objects with different execution paths, the compiler cannot perform the optimization.
:
, pragmas:
#pragma GCC push_options
#pragma GCC optimize (ARG)
#pragma GCC pop_options
, __ __ (()):
void __attribute__((optimize(ARG))) foo(unsigned char data) {
}
ARG (.. ), , 0 (.. ) .. ARG "O0". , gcc -S, . gcc 4.4 .