[Issue 13586] Destructors not run when argument list evaluation throws

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Oct 9 01:15:21 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13586

monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra at gmail.com

--- Comment #2 from monarchdodra at gmail.com ---
(In reply to Walter Bright from comment #0)
> The fix is similar to what Kenji did to ensure left to right order of
> evaluation of arguments. If any arguments have destructors, then the
> argument list has to be constructed before attempting to put the argument
> list on the stack, because destructing them on a partially built stack is
> problematic. The arguments are then blitted to the stack, because the blit
> operation cannot throw.

It's also similar to what "opAssign implemented in terms of postblit" does.
Speaking of which, in both cases, if all the arguments can be evaluated in
nothrow context, then it should be OK to build the arguments in place directly.

Aren't you worried that we'll take a general performance hit building the
arguments and then moving them every time we make a call?

Hows does C++ deal with this?

--


More information about the Digitalmars-d-bugs mailing list