delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/07/26/07:30:34

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Paul Wilkins <disk AT paradise DOT net DOT nz>
User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: strange error
References: <AL1Nc.380$zS6 DOT 55822 AT news02 DOT tsnz DOT net> <20040726055220 DOT 22465 DOT 00000447 AT mb-m11 DOT aol DOT com> <Ca5Nc.440$zS6 DOT 63234 AT news02 DOT tsnz DOT net>
In-Reply-To: <Ca5Nc.440$zS6.63234@news02.tsnz.net>
Lines: 34
Message-ID: <6U5Nc.449$zS6.65197@news02.tsnz.net>
Date: Mon, 26 Jul 2004 23:26:47 +1200
NNTP-Posting-Host: 218.101.50.29
X-Complaints-To: abuse AT tsnz DOT net
X-Trace: news02.tsnz.net 1090841218 218.101.50.29 (Mon, 26 Jul 2004 23:26:58 NZST)
NNTP-Posting-Date: Mon, 26 Jul 2004 23:26:58 NZST
Organization: TelstraClear
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Paul Wilkins wrote:

Do not post when tired.

> Let's head back to the line where the trouble occurs, which I presume 
> you want to fix.
> 
> m55:r--;if(R[r]!=1)goto m55;
> 
> r gets decreased until R[r] = 1.
> 
> That needs to be fixed so that r doesn't go below 0
<snip>
> Is that right?
> 
> In that case, let's count down to 0 and break out when we're successful.
> 
> for (r; r>=0; r--) if (R[r]==0) break;

Make that
   for (r; r>=0; r--) if (R[r]==1) break;

> 
> or
> 
> for (r; r>=0; r--)
>   if (R[r]==1)
>     break; // out of for loop

If you don't want to check R[0] (ie. you use R[1] as your first entry) 
then change r>=0 to r>0 or r>=1

-- 
Paul Wilkins

- Raw text -


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