all OS functions should be "nothrow @trusted @nogc"
H. S. Teoh via Digitalmars-d
digitalmars-d at puremagic.com
Tue Aug 1 15:52:26 PDT 2017
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.
T
--
Don't get stuck in a closet---wear yourself out.
More information about the Digitalmars-d
mailing list