Why are you using D instead of Rust?
Paolo Invernizzi
paolo.invernizzi at gmail.com
Sat Oct 23 12:01:48 UTC 2021
On Saturday, 23 October 2021 at 11:36:58 UTC, ag0aep6g wrote:
> On 23.10.21 09:53, jfondren wrote:
>> bool encryptsTo(const(char)* key, const(char)* salt,
>> const(char)* hash) @trusted {
>> import std.string : fromStringz;
>>
>> return hash.fromStringz == crypt(key, salt).fromStringz;
>> }
>
> That function can't be @trusted. "Any function that traverses a
> C string passed as an argument can only be @system."
>
> https://dlang.org/spec/function.html#safe-interfaces
I think that should be: "Any function that traverses a C string
_not verified to be null terminated_ can only be system".
If that check is done in the D wrapper, the function can be
correctly trusted.
More information about the Digitalmars-d
mailing list