1. For loop variables reported incorrectly in ex.err file

The following test program demonstrates the problem:

procedure t(integer i)
	for j=i to i do
		if i=1 then ?9/0 end if
		t(i-1)
	end for
end procedure
t(3)

It creates the following ex.err file, clearly duplicating the current
value of j rather than showing the correct value from the calling
scope:

C:\test.exw:3 in procedure t() 
attempt to divide by 0 
	i = 1
	j = 1

... called from C:\test.exw:4 in procedure t()  
	i = 2
	j = 1

... called from C:\test.exw:4 in procedure t()  

	i = 3
	j = 1

Regards,
Pete

new topic     » topic index » view message » categorize

2. Re: For loop variables reported incorrectly in ex.err file

Pete Lomax wrote:
> The following test program demonstrates the problem:
> 
> procedure t(integer i)
> 	for j=i to i do
> 		if i=1 then ?9/0 end if
> 		t(i-1)
> 	end for
> end procedure
> t(3)
> 
> It creates the following ex.err file, clearly duplicating the current
> value of j rather than showing the correct value from the calling
> scope:
> 
> C:\test.exw:3 in procedure t() 
> attempt to divide by 0 
> 	i = 1
> 	j = 1
> 
> ... called from C:\test.exw:4 in procedure t()  
> 	i = 2
> 	j = 1
> 
> ... called from C:\test.exw:4 in procedure t()  
> 
> 	i = 3
> 	j = 1

Thanks. I recall there's something special about
mixing for loops with recursion. I'll fix the
code that generates ex.err files.

Regards,
    Rob Craig
    Rapid Deployment Software
    http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu