On 2/5/15 1:12 PM, Zach the Mystic wrote:


Hey I like the creativity you're showing. Just to give people a concrete
idea, you might show some sample code and illustrate how things work. It
sure helps when I'm trying to think about things.

So for example:

@safe int *foo()
{
   int *x;
   int *y;
   int z;
   x = new int; // ok
   //y = &z; // not OK
   @trusted y = &z; // OK, but now y is marked as @trusted
   // return y; // not OK, cannot return @trusted pointer in @safe function
   return cast(@safe)y; // ok, we are overriding the compiler.
   // and of course return x; would be ok
}

-Steve

Reply via email to