Issue with char and string overlap
Ali Çehreli
acehreli at yahoo.com
Fri Jul 19 11:18:37 PDT 2013
On 07/19/2013 10:40 AM, anonymous wrote:
> On Friday, 19 July 2013 at 17:18:00 UTC, JS wrote:
>> for(int j = 0; j < s.length - d.length; j++)
>
> This j would shadow the one above. Just choose another name.
Even better:
foreach (k; 0 .. s.length - d.length)
or:
foreach (k; iota(s.length - d.length))
Also, either code must deal with the case where d.length is greater than
s.length. Otherwise, being a size_t, the subtraction will be a large value.
Ali
More information about the Digitalmars-d-learn
mailing list