@trust is an encapsulation method, not an escape

Zach the Mystic via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 6 21:48:28 PST 2015


On Saturday, 7 February 2015 at 05:35:51 UTC, Zach the Mystic 
wrote:
> Here's how I would rewrite what you have written using the new 
> method:
> ...
>     stat_t statbuf = void;
>     @system cenforce(trustedFstat(fd, trustedRef(statbuf)) == 
> 0, name);

I didn't rewrite this because I didn't see the trustedXXX 
functions they referred to, but the basic rewrite would be:

@system cenforce(fstat(fd, reff(statbuf) == 0), name);

In other words, just copy the @system code directly without going 
through @trusted.


More information about the Digitalmars-d mailing list