char[] annoyance...
Lionello Lunesu
lio at lunesu.remove.com
Mon Apr 10 00:20:35 PDT 2006
> if (line.length >= 2) {
> for(int i = 0; i < line.length-2; i++) {
> if (line[i..i+2] != "||") continue;
> //..etc..
> }
> }
> else {
> // do something for short lines...
> }
It seems silly to add another 'if', knowing that the compiler could
simply use the signed branch instructions instead of the unsigned ones.
Does the spec define what happens when comparing a signed against an
unsigned type? Perhaps one or the other should be manually cast in this
case. Or, force the comparison as signed. That would have prevented the
length-2 bug.
L.
More information about the Digitalmars-d
mailing list