Possible bug in skipOver() from std/algorithm/searching.d

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 22 02:30:14 PST 2017


On Sunday, 22 January 2017 at 10:01:09 UTC, Danny Arends wrote:
> On Sunday, 22 January 2017 at 09:55:49 UTC, Danny Arends wrote:
>> Hey all,
>>
>> I encountered some unexpected behavior in std.format, I was 
>> parsing Wavefront obj file, and ran into an issue. I updated 
>> the compiler to the latest stable version (// DMD64 D Compiler 
>> v2.072.2), however I think it's a Phobos related issue.
>>
>> [...]
>
> Two further observations:
>
> (Obs 1)
>
> 47 is ascii code for forwards slash '/'
>
> (Obs 2)
>
> Changing the line:
>
> l.skipOver(x);
>
> to:
>
> l.skipOver(to!string(x));
>
> Does not show the bug.

This is not a bug.
But working as intended.
you call skip over with an (char[] skip, int overThis)
and skip over will do comparions like this (if (skip[pos] == 
overThis))
and since '\' == 47;
it will skip over that one.


More information about the Digitalmars-d mailing list