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

Shachar Shemesh via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 25 07:27:14 PDT 2017


On 25/07/17 17:12, Stefan Koch wrote:
> On Tuesday, 25 July 2017 at 13:50:16 UTC, 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.
>>
>> I can try and set up a PR when I have the time. If anyone else wants 
>> to take an easy one before then, you're welcome to :-)
>>
>> Shachar
> 
> these functions are supposed to have trused wrappers if used in safe code.

I'd love to hear the difference between:
extern(C) int signalfd (int __fd, const(sigset_t)* __mask, int __flags) 
nothrow @nogc;

and
int signalfdWrapper(int __fd, const(sigset_t)* __mask, int __flags) 
nothrow @trusted @nogc {
	return signalfd(__fd, __mask, __flags);
}

Or are you suggesting the wrapper do something else?

Shachar


More information about the Digitalmars-d mailing list