Comparing function pointers

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 11 10:47:22 PST 2015


On Wednesday, 11 February 2015 at 18:40:05 UTC, Freddy wrote:
> Is the intended behavior?

Yes. test2 returns a delegate that closes over a separate copy of 
the local variable, so the data pointer is different each time.

You can get the two pointers with .funcptr and .ptr. You'll find 
.funcptr is the same but .ptr changes.


More information about the Digitalmars-d-learn mailing list