No warning if loop variable is used after for-loop without "break"
Original Reporter info from Mantis: Borneq
-
Reporter name: Andrzej Borucki
Original Reporter info from Mantis: Borneq
- Reporter name: Andrzej Borucki
Description:
Value after for loop sometimes is used to distinguish if was break.
In Delphi value is next to last bound, in FreePascal value is last bound.
If FreePascal solution has more sense, should be Delphi solution for
{$MODE Delphi}
or warning: value after loop may be undefined
Steps to reproduce:
{$MODE Delphi}
var i: integer;
begin
for i:=0 to 9 do;
writeln(i);{delphi say 10, FreePascal say 9}
for i:=0 to 9 do if i=9 then break;
writeln(i);{delphi say 9, FreePascal say 9}
end.
Mantis conversion info:
- Mantis ID: 18234
- OS: WindowsXP
- Platform: x86
- Version: 2.4.2