[fpc-pascal] Illegal counter variable?

James Richters james at productionautomation.net
Wed Sep 11 20:25:55 CEST 2019

I reported it here:





>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 <scoxbike at shaw.ca <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/717091a5/attachment.html>

More information about the fpc-pascal mailing list