On 06/21/2017 12:06 PM, uncorroded wrote:

> Is
> there any way of making the function with @safe as well? I get the
> errors "cannot call @system function 'core.stdc.stdio.fread,fopen,fclose'.

@trusted is exactly for that. It can be called from @safe code:

@trusted @nogc ubyte[n] rand_bytes(uint n)() {
    // ...
}

@safe auto foo() {
    return rand_bytes!3();
}

Ali

Reply via email to