A Problem (?) With For -- To -- Do lazarus / 13-General ---------------------------------------------------------------------- Curt Carpenter · 2013-04-10 17:39 This is a dumb mistake, but I wonder if FPC should issue an error when it occurs?  (Or perhaps it DOES issue one if you have the compiler switches set correctly, and I don't?) procedure foo(n: integer); var i: byte; begin   for i := 0 to N do ; end; If the argument N >255, the for--to--do statement seems to simply not execute at all, with no warning to let you know that the variable i really needs to be an integer, not a byte.  Does range checking turned on catch this? ---------------------------------------------------------------------- Blaazen · 2013-04-10 17:51 QuoteIf the argument N >255, the for--to--do statement seems to simply not execute at all, with no warning to let you know that the variable i really needs to be an integer, not a byte. Not true, it behaves like (N and 255). Code: [Select]begin   n:=257;   for i := 0 to N do ; end;will be likeCode: [Select]for i:=0 to 1 doI think this is by design, it is not a bug. QuoteDoes range checking turned on catch this?It raises exception here. ---------------------------------------------------------------------- Curt Carpenter · 2013-04-10 22:38 Ah -- interesting.  Thanks.