Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A For-Next bug in 1.2.8-s682
#5
boriel Wrote:At the moment, the only way to fix this is:
Code:
LET z = i + N - 1
For i = i to z
  Poke i, AttrColor
Next i
Can you check this?

Which produces the expected behavior. I'm thinking in fixing this in an more efficient manner, so the user can choose dynamic or static FOR loops with a #pragma directive, and let FOR to be static by default for compatibility's sake. What do you think?

This would work, no need to check it and it would speed up the current
code. I did think that this was it, that is how the loops were evaluated at
the beginning. This did produce some "undefined" behaviour that did not
make any sense. Is a directive needed? Looks to me that the C style is the
poor mans way of doing For-Next loops. What are the benefits? There are
already some cons as noted above both in terms of workarounds and speed.
If you are thinking about attracting C coders then I think the sacrifice in
consistency, even with a pragma directive, is not worth it.

A man is nothing if not consistent.

Thanks for your(s) reply(s),

Darkstar.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)