[fpc-pascal] Illegal counter variable?

Bart bartjunk64 at gmail.com
Mon Sep 9 19:27:49 CEST 2019


On Mon, Sep 9, 2019 at 4:54 PM Jonas Maebe <jonas at freepascal.org> wrote:

> "var i : longint = 0;" is internally handled using the same code path as
> "const i : longint = 0", and typed constants cannot be used as counter
> variables. This is indeed probably a bug.

D7 does not allow this for global variables: "for loop variables must
be simple local variables".
In D7 you cannot initialize a local variable, so I cannot test that scenario.
Someone with a more recent Delphi should check if this sysnatx is allowed.

-- 
Bart


More information about the fpc-pascal mailing list