What should happen here?

IGotD- nise at nise.com
Mon Sep 20 18:39:20 UTC 2021


On Monday, 20 September 2021 at 18:26:59 UTC, Steven 
Schveighoffer wrote:
> Without any context, what do you think should happen here?
>

Is this a trick question?

In a perfect world I think option 1 should happen.

However doesn't it depend on how the compiler decide what to do 
with variable c. It can be in a register or it can be on stack. 
If it is on stack, then the GC believe it is still in use. If it 
is in a register, then the compiler is likely to optimize c away 
before the loop and the GC destroys it.

In reality, I guess option 4.



More information about the Digitalmars-d mailing list