Am 09.09.2019 um 16:11 schrieb James Richters:
I just don't see why having the limitation, there is no technical reason that
the for loop couldn't change that I can see.. especially since it works in TP
The original reason why some Pascal implementations had this limitation:
for performance or optimization reasons, the loop control variable was
transferred to a register at the beginning of the loop, and changing the
variable (at its storage location) inside the loop simply had no effect,
because the variable was not fetched from there again during loop
Worse: maybe, to make read accesses to the loop control variable valid
inside the loop, they are prepared by storing the control register value
into the loop control variable, thus turning changes to the loop control
Forbidding (write) accesses to the loop control variable allows for many
aggressive optimization strategies around loops.
Maybe today such limitations seem too restrictive.
fpc-pascal maillist - email@example.com