Closures and loop scope

Dicebot public at dicebot.lv
Tue Jul 23 07:06:30 PDT 2013


On Tuesday, 23 July 2013 at 13:37:26 UTC, JS wrote:
> It is wrong to use a local variable inside a delegate when the 
> delegate is called outside the scope of that variable. This 
> should technically be an error as it is undefined behavior.

AFAIK it is defined in D, compiler should move it to heap if it 
is captured by delegate and gets out of scope.


More information about the Digitalmars-d mailing list