www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/19/06:18:56

Date: Wed, 19 May 1999 12:18:18 +0200
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Message-Id: <199905191018.MAA04399@acp3bf.physik.rwth-aachen.de>
To: djgpp AT delorie DOT com
Subject: Re: Odd problem...
Newsgroups: comp.os.msdos.djgpp
Organization: RWTH Aachen, III. physikalisches Institut B
X-Newsreader: TIN [version 1.2 PL2]
Reply-To: djgpp AT delorie DOT com

In article <19990519053901232 DOT AAA56 DOT 87 AT mike-s-toy> you wrote:

You have a fundamental bug in your program. Had you tried to really
trim it down to the absolute minimum, throwing away everything that
doesn't directly seem to be part of the bug itself, you might have
found it yourself. 

[...]

>     for(i=0;i<=200;i++)
>     {
>         ScreenClip.Start[i]=0;ScreenClip.End[i]=320;
>     }

By removing this block of code, you would have removed the bug. The actual
problem is that '<=200' in the loop end condition. You're accessing Element
ScreenClip.Start[200], which does not exist (only elementes [0] to [199] do).
This write past the end of ScreenClip hits the beginning of 'Hex' in memory,
and destroys Hex.Vert[0]


As a side note: you have a number of completely superfluous casts in
your code. They're do nothing, except cluttering the source code, so
you might just as well remove them.

--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019