[fpc-pascal]RE: The inexplicable overflow.

A.J. Venter ddt at headrush.co.za
Fri Sep 27 10:03:32 CEST 2002

If followed the advice presented and recompiled with range checking and 
overflow checking on. My program subsequently caused a near immediate 201 
The compiler issues this warning:

minerunner.pas(95,56) Warning: Mixing signed expressions and cardinals 
here may cause a range check error

Line 95 looks like this:
 If (level.block[blockX,blockY].what = pit) And 
(SDL_Getticks > level.block[blockX,blockY].digtime + 10000)

The code in question steps through the level, looking for pit's (holes dug 
by the player) and when it finds them the if statement above is used to 
compare the time when the hole was dug with the current time, if more than 
10 secconds elapsed the hole is filled up again.

It is interesting that a different problem occurs if I turn on integer 
overflow checking and not range checking, the program then fails in 
characters.draw (though I cannot determine which character is being drawn 
when it happens).

What I would love to do is a line by line step over and execute like you 
could in BP, however GDB refuses to step unless you run the program - 
which then happens without a pause until the program exits or waits for 
input - since the game's input is asynchrounous it never waits for input.

Is there anyway to do this ? So I can step over the code and determine the 
exact moment of the errors - which when combined with a few whatches 
should allow me to solve them.

A.J. Venter

"If you can't beat your computer at chess - do what I did. Try kickboxing" 

A.J. Venter

More information about the fpc-pascal mailing list