[fpc-pascal] Re: Range checking in a for loop
leledumbo
leledumbo_cool at yahoo.co.id
Mon Oct 25 15:28:29 CEST 2010
OK, thanks. I just want to know why such a thing cannot be detected at
compile time. So, a good typing practice is the solution, right? Like this:
program test;
type
TArrayRange = 1..3;
TArray = array[TArrayRange] of Integer;
var
a: TArray;
i: TArrayRange;
begin
for i := 1 to 4 do
a[i] := i;
end.
--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Range-checking-in-a-for-loop-tp3235085p3235405.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
More information about the fpc-pascal
mailing list