[fpc-devel] Debugging Loop Unroll Optimization

Thorsten Engler thorsten.engler at gmx.net
Fri May 18 17:16:00 CEST 2018

> It is *not* undefined when the loop is left with break or exit,
> that's the point. The ISO is not a very good reference for modern-
> ish Pascal.

I think based on both documented and observed behaviour, the following definition would be appropriate:

The for-loop variable is undefined after the loop if the loop ran to completion. It retains its last value if the loop exited in a controlled way (goto, break, exit, ?) before running to completion.

The ISO standard basically listed all known "controlled" ways to exit the loop before it ran to completion. It's just that in the meantime other flow control methods have been added.

More information about the fpc-devel mailing list