I don't believe you.
$ cat bug_l9908261.pike int main(int argc, array(string) argv) { string foo="gazonk"; int i;
for(i=0;i<sizeof(foo);i++) { if (i%2) { foo = foo[1..]; } } werror("i:%O\n", i); } $ ./pike -mmaster.pike bug_l9908261.pike i:4
Please provide an example that actually triggers the alleged bug.
/ Henrik Grubbström (Lysator)
Previous text:
2003-03-20 10:26: Subject: for-loop optimization
I just wrote a for-loop like this:
string foo="gazonk";
for(int i=0;i<sizeof(foo);i++) {
... do stuff ...
if (sometimes) foo = foo[1..];
... do stuff ...
}
The problem I discoverd was that when the length of foo is changed, the loop still tries to loop over the original length of foo. The problem dissappeard when I replace sizeof(foo) with a variable and update it when changing the length of foo.
Is this the correct behaviour or is the optimizer doing more than it should here?
/ Marcus Agehall (Trådlös)