[fpc-pascal]Re: "for" loop questions

Matt Emson memsom at interalpha.co.uk
Sun Dec 8 11:31:35 CET 2002


However, the code below is an example of what *not* to do ;-)

You are comparing signed and unsigned types, wore still you are first
converting a signed type to an unsigned one before the comparison. I know
you were simply giving an example that does crash, but doing what you have
done in the code is pretty stupid anyway.

Matt

> {$MODE DELPHI}
> uses
>  Classes;
> var
>   L : TList;
>   P : Pointer;
>   I : Integer;
>   W: word;
> begin
>   L := TList.Create;
>   W := L.Count - 1;
>   for I := 0 to W do begin
>     P := L[I];
>   end;
> end.






More information about the fpc-pascal mailing list