Scope of temporaries as function arguments
monarch_dodra
monarchdodra at gmail.com
Fri Jun 28 10:53:17 PDT 2013
On Friday, 28 June 2013 at 17:30:58 UTC, Ali Çehreli wrote:
> 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.
Doesn't it? The stack needs to be unwound for the exception to
even "escape". It's merely the globals that may not be destroyed.
(AFAIK)
> 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