[fpc-pascal] Value of runner variable after a for loop

Flávio Etrusco flavio.etrusco at gmail.com
Mon Mar 12 17:54:38 CET 2007

> I would NEVER rely on this in production code. The value of the control
> variable of a For loop after execution should never be relied upon. A simple
> change in the compiler at some future point could break a lot of your code.

To be honest I would call it a bug if a comipler didn't warn about it
(I don't only advocate it being reported as an 'error' so people don't
call me a fanatic ;-)

IMHO the for-loop variable should be visible only inside the loop and
should even be not reusable ;-) Actualy I've always dreamed the
somebody came up with a Pascal-coherent syntax for scoped variables,
but now FPC has inline functions support, I guess I was dreaming of
the wrong feature ;-)

But I still dream the day people agreed that all variables had to be
declared with a some modifier to be alowed to be assigned (with ':=')
more than once ;-)


More information about the fpc-pascal mailing list