Expressions should *never* expand to constants unless they *are* constants. I suppose that a good optimizer could see if 'foo' were being changed in the loop, though.
Anyway, I can't repeat the problem:
int a=0; array foo=({1,2,3}); for (a=0; a<sizeof(foo); a++) { werror("%O\n",foo[a]); foo=foo[1..]; }
This happily outputs 1, 3 and exits for me.
/ Mirar
Previous text:
2003-03-20 10:47: Subject: for-loop optimization
I'll admit it is inconsitent, but I should have said "sizeof(b) should always be expanded to a constant b2 in the for expression". That is becouse for some reason I expect the optimizer to give me a set number of loops. I'll admit that it might not be as my mind makes it. ;-)
/ Peter Bortas