On 01/03/2013 12:48 AM, Jason House wrote:
...


ref int bar()
{
    int i = 7;
    return foo(i);
}

If @safe, this code will not compile.
Error: foo may return a local stack variable
Since "i" is a local variable, "foo(i)" might return it.



ref int baz(int i)
{
    return foo(i);
}

This function is fine. "i" is an input argument so "foo(i)" is
considered to be equivalent to an input argument.


Those two cases are pretty much the same.

Reply via email to