[fpc-pascal] type conversions
Jonas Maebe
jonas at zeus.rug.ac.be
Mon Dec 9 13:10:45 CET 2002
On maandag, dec 9, 2002, at 13:04 Europe/Brussels,
Michael.VanCanneyt at wisa.be wrote:
>> TList.count returns -1, this is converted to a 16 bit unsigned value =
>> 65535 -> the loop is run from 0 to 65535 (and crashes in the first
>> iteration).
>
> How can TList.count return a -1 ? Normally, this cannot happen.
Well, the expression was:
var
i: tunsigned16; { or something like that }
begin
for i := 0 to (tlist_var.count - 1) do
...
So count returned 0, then 1 was sibstracted and the result was
converted to a word...
Jonas
More information about the fpc-pascal
mailing list