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

Moritz Maxeiner via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 1 16:09:00 PDT 2017


On Tuesday, 1 August 2017 at 22:52:26 UTC, H. S. Teoh wrote:
> On Tue, Aug 01, 2017 at 06:46:17PM -0400, Steven Schveighoffer 
> via Digitalmars-d wrote:
>> On 8/1/17 6:17 PM, Moritz Maxeiner wrote:
> [...]
>> > 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.
> [...]
>
> Welcome to the wonderful world of autodecoding. :-D
>
> OTOH, we could just use byCodeUnit and we wouldn't need the 
> cast, I think.

I was lazy, okay (I nearly forgot putting the auto decoding 
prevention in there, because I always forget that D has auto 
decoding; it irks me as well) :p


More information about the Digitalmars-d mailing list