On 2/12/2015 3:40 AM, Freddy wrote:
import std.stdio;
auto test1(){
void testFunc(){
}
return &testFunc;
}
auto test2(){
uint a;
void testFunc(){
a=1;
}
return &testFunc;
}
void main(){
writeln(test1()==test1());//true
writeln(test2()=
On Wed, 11 Feb 2015 18:40:03 +, Freddy wrote:
>
> import std.stdio;
>
> auto test1(){
> void testFunc(){
> }
> return &testFunc;
> }
>
> auto test2(){
> uint a;
> void testFunc(){
> a=1;
> }
> return &testFunc;
> }
>
> void main()
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