[PATCH] Declension of month names in dates
Pal-Kristian Engstad
engstad at naughtydog.com
Fri Aug 16 03:24:59 BST 2002
Not to be pedantic, but you can always "break" out of a loop. I.e., replace:
j = 1;
while (error && (j < 13)) {
QString s = monthNamePossessive(j, c == 'b').lower();
int len = s.length();
if (str.mid(strpos, len) == s) {
month = j;
strpos += len;
error = false;
}
j++;
}
with:
for (j = 1; j < 13; j++) {
QString s = monthNamePossesive(j, c == 'b').lower();
int len = s.length();
if (str.mid(strpos, len) == s) {
month = j;
strpos += len;
break;
}
}
This is much clearer. Now, if you need to use 'error' as a flag for an early
out, there's nothing wrong by using a goto, or even better, restructure it to
return.
PKE.
More information about the kde-core-devel
mailing list