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

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 2 09:32:44 PDT 2017


>> import std.algorithm;
>> // I probably wouldn't even define this but use the body as is
>> auto strnlen_safe(in char[] str)
>> {
>>      return countUntil(cast(ubyte[]) str, '\0');
>> }
> 
> Oh that cast.... it irks me so.
> 
> -Steve

return str.representation.countUntil('\0');

Andrei


More information about the Digitalmars-d mailing list