"loop variable usually should be of signed type"
instead "loop variable always must be of signed type"
And that is one of the big issues with this. The compiler can only do best guess, and it sometimes will go wrong.
"Not a problem", I was told. In those cases I can still declare the loop var:
var i: qword;
...
for i := OldCount to Count - 1 do // at this point, it is guaranteed that count will be >=1
...
qword is needed because count could be a very large value ( >high(int64) ). And yes, this can happen, e.g. with sparse lists, or if values are calculated rather than stored.
But anyway, it works, so why am I mentioning it?
Well, because as I regularly do, some month later, I refactor, and I need to rename "i" to "idx".
Because (if the feature was available) loop vars are normally not declared, I expect that to be the case here too. I only rename in code, I do not update the declaration (why should I?) .
It compiles fine. It passes my basic tests, despite now it is an Int64 (auto detected by compiler, "idx" is not declared).
I ship my app. A few weeks later I get lots of calls from my clients.
The app keeps crashing.
All so someone could be a bit lazier. type a bit less, read a bit less.