[fpc-pascal]Re: fpc-pascal digest, Vol 1 #1610 - 12 msgs

memsom at interalpha.co.uk memsom at interalpha.co.uk
Mon Dec 9 11:19:27 CET 2002


> I : tUnsigned16;

Um, unsigned... this will always equate to 0 if the count is 0 because an 
*unsigned* number can _only_ hold positive numbers (0..n, *not* -n..(n -1)). So 
0 -1 can only be 0 because 0 is the smallest number the variable can hold. For 
i := 0 to 0 do ; will indeed execute one itteration, and cause an access 
violation if you attempt to access memory that was no allocated (as you will) 
with your pointer.

Change it to a signed type (longint, integer, smallint, int64, etc) and you 
will no longer crash, I guess.

Matt 


---------------------------------------------
This message was sent using Mistral WebMail.
http://www.mistral.co.uk/






More information about the fpc-pascal mailing list