Multiple return values...

Timon Gehr timon.gehr at gmx.ch
Sun Mar 11 16:15:31 PDT 2012


On 03/11/2012 11:58 PM, Robert Jacques wrote:
> Manu was arguing that MRV were somehow special and had mystical
> optimization potential. That's simply not true.

Not exactly mystical, but it is certainly there.

void main(){
     auto a = foo(); // MRV/struct return
     bar(&a.x); // defined in a different compilation unit
}

struct return has to write out the whole struct on the stack because of 
layout guarantees, probably making the optimized struct return calling 
convention somewhat slower for this case. The same does not hold for MRV.





More information about the Digitalmars-d mailing list