On 25 Oct 2010, at 13:54, Jonas Maebe wrote:
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
e
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 thoug
25.10.2010 16:06, leledumbo wrote:
Consider the following program:
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 that there's an
out of bounds array index when i = 4.
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 th
Consider the following program:
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 that there's an
out of bounds array index when i = 4.
Since the behavior of for loop in FPC