scope ref a(scope ref int x) { return x; } void b(scope ref int x);
On 24 April 2013 11:02, Diggory <digg...@googlemail.com> wrote: > On Wednesday, 24 April 2013 at 00:54:12 UTC, kenji hara wrote: > >> 2013/4/24 Manu <turkey...@gmail.com> >> >> "The r-value being passed is assigned to a stack allocated temporary, >>> which has a lifetime that is identical to any other local variable, ie, >>> the >>> lifetime of the function in which it appears." >>> There, I defined it. >>> >>> >> Good definition. If add more, >> "getting address of "scope" parameter would be disallowed, at least in >> @safe code, because it would be regarded as the escape of stack allocated >> temporary." >> >> Kenji Hara >> > > Why does the temporary need to exist any longer than the current > statement? (the current lifetime of temporaries are the statement or > expression). Surely any longer is just wasting stack space. >