Scope of temporaries as function arguments

Ali Çehreli acehreli at yahoo.com
Fri Jun 28 10:30:57 PDT 2013


On 06/28/2013 10:17 AM, Maxim Fomin wrote:

 > Are you sure that the code is exact translation of demonstrated D
 > problem?

Sorry. I omitted two points.

 > I see difference in argument passing order and your version
 > uses try-catch block.

1) C++ does not specify whether the stack gets unwound when the program 
terminates with an uncaught exception. That's why I caught to ensure 
that the stack objects would be destroyed.

2) C++ does not specify in what order function arguments are evaluated. 
I swapped the parameters because I used gcc under Linux, where the 
parameters are executed from right-to-left.

Ali



More information about the Digitalmars-d-learn mailing list