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

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 25 11:09:59 PDT 2017


On 7/25/17 12:46 PM, Kagamin wrote:
> On Tuesday, 25 July 2017 at 15:12:30 UTC, Steven Schveighoffer wrote:
>> I think signalfd can be marked @trusted, as @safe code supports 
>> pointing at a single element.
> 
> What about functions that take zero terminated strings? Are they ok to 
> read past the end of allocated object?

No, a null terminated string is as arbitrary as passing in a length.

Unfortunately, it's perfectly safe to call with a string literal. But 
there is no way to detect that during compile time. So it has to be unsafe.

The wrapper would be to use toStringz to make the call.

-Steve


More information about the Digitalmars-d mailing list