Re: [fpc-pascal] Range checking in a for loop

2010-10-25 Thread David W Noon
On Mon, 25 Oct 2010 01:06:16 -0700 (PDT), leledumbo wrote about [fpc-pascal] Range checking in a for loop: [snip] program test; var a: array [1..3] of Integer; i: Integer; begin for i := 1 to 4 do a[i] := i; end. The compiler will accept this code happily, despite the fact

Re: [fpc-pascal] Range checking in a for loop

2010-10-25 Thread Jonas Maebe
On 25 Oct 2010, at 13:24, David W Noon wrote: Try declaring i : 1..3; instead, as that range matches the array's bounds. You should then get a range check at compile time. With current released versions, you won't get such a compile time error. I fixed that just yesterday in svn