Inline variables in loops

485 views Asked by At

What happens if inline variables are used inside a loop:

for i := 1 to N do
  begin
  for var j := 1 to M do
    begin
      { Do something with i and j }
    end;
  end;

The scope of the variable j is only the inner loop. Does this mean that the memory for j will be allocated and deallocated N times? This may cause quite some performance penalty in tight loops.

0

There are 0 answers