[fpc-pascal] private integer is an illegal counter variable

Juha Manninen juha.manninen at phnet.fi
Fri Nov 27 15:49:59 CET 2009


If I define a private integer:

  TDemo = class(TCustomApplication)
    i: integer;

and in a protected method I use it:
  for i := 0 to List.Count - 1 do

then I get an error:
  Error: Illegal counter variable

Moving it to method's var section helps.
Method's var section is also better place for it in general, but still it 
should be legal to use a private member as counter var.

Bug or feature?

Juha Manninen

More information about the fpc-pascal mailing list