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

ag0aep6g via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 25 07:11:14 PDT 2017


On 07/25/2017 03:50 PM, Shachar Shemesh wrote:
> The title really does says it all. I keep copying OS function 
> declarations into my code, just so I can add those attributes to them. 
> Otherwise I simply cannot call "signalfd" and "sigemptyset" (to name a 
> couple from my most recent history) from @safe code.

Not all OS functions can be `@trusted`.

I don't about `signalfd` and `sigemptyset`, but `read` [1] can't be 
`@trusted`, for example. It takes pointer and length separately, and the 
pointer is a `void*`. That's not safe at all.


[1] http://man7.org/linux/man-pages/man2/read.2.html


More information about the Digitalmars-d mailing list