all OS functions should be "nothrow @trusted @nogc"

Moritz Maxeiner via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 25 11:36:35 PDT 2017


On Tuesday, 25 July 2017 at 18:07:06 UTC, Steven Schveighoffer 
wrote:
> On 7/25/17 12:14 PM, Kagamin wrote:
>> While we're at it, check this: 
>> https://github.com/dlang/druntime/blob/master/src/core/stdc/stdio.d#L1047
>
> Looks fine to me. That's not an array of FILE, it's a single 
> pointer.

fgetc cannot be @trusted the same way fclose cannot be @trusted.
If you pass either of them `null` - which constitutes a legal 
@safe context - the behaviour is undefined, which contradicts 
@trusted definition:
<Trusted functions are guaranteed by the programmer to not 
exhibit any undefined behavior if called by a safe function.>


More information about the Digitalmars-d mailing list