make @safe "non-escapable"?
Robert
jfanatiker at gmx.at
Wed Feb 6 14:56:44 PST 2013
> So this would be the behavior?
>
> @system {
> int test1() {} //@system
> int test1() @safe {} //of course!
> int test1() @trusted {} //of course!
> a = b;
> }
Yeah.
>
> @trusted { //disallowed for (bulk) function/type declarations
> //intended only for bits of code or for functions:
> //Otherwise an easy unchecked breeding ground for
> bugs!
> int test1() {} //error
> int test1() @safe {} //error
> int test1() @system {} //error
> int test1() @trusted {} //error, yes it is, even if explicit
> a = b;
> }
Why would the @safe definition be an error?
>
> @safe {
> int test1() {} //@safe
> int test1() @trusted {} //will happen from time to time.
> int test1() @system {} //error, cannot weaken code's
> restrictions
> a = b; //only if safe
> }
The @trusted definition must not be allowed either. @trusted good is as
good as @system code in this context, because the compiler guarantees
nothing.
More information about the Digitalmars-d
mailing list