[fpc-pascal] Illegal counter variable?

DougC doug at moosemail.net
Wed Sep 11 19:09:24 CEST 2019

Actually, the original code used two VARs, not typed CONST. One VAR was initialized and one was not. I think this is a bug and should be fixed.

As Jonas already pointed out:

"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.

---- On Wed, 11 Sep 2019 12:40:57 -0400  <mailto:scoxbike at shaw.ca> wrote ----

Yes, off topic. The initial poster's code had the loop variable declared as an initialized constant. Not as a true variable. No FPC in hand, I can't test if setting 'assignable typed constants = true' would permit the use of an initialized typed constant or not. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190911/8b2a30f5/attachment.html>

More information about the fpc-pascal mailing list