I dont know if this has been documented anywhere, but Im putting it
out here as it caused me some grief.
It appears that Q-Liberator zeroes the loop variable on entry to a
loop. The following demo, which is acceptable (although perhaps not
very elegant) S*BASIC, will not work in the same way once compiled
with Qlib.
100 loop = 3
110 cnt = 0
120 PRINT 'Start:'! loop, cnt
130 REPeat loop
140 PRINT loop, cnt
150 cnt = cnt + 1
160 IF cnt >= loop: EXIT loop
170 END REPeat loop
180 PRINT 'End:'! loop, cnt
190 PAUSE: QUIT
In the Qlib-compiled version the loop is exited after a single run as
the condition cnt >= loop is met immediately, to wit 1 >= 0
The worrying part of this is that while I was figuring out what was
wrong, running an embedded routine like this many times, the system
crashed due to memory corruption. Whether this was due to the SBASIC
or Qlib compiled version I cant say right now. So just beware and keep
on progging!
NB: This works, though. As long as you start out with loop = 0
100 loop = 0
110 cnt = 3
120 PRINT 'Start:'! loop, cnt
130 REPeat loop
140 PRINT loop, cnt
150 loop = loop + 1
160 IF loop >= cnt: EXIT loop
170 END REPeat loop
180 PRINT 'End:'! loop, cnt
190 PAUSE: QUIT
Per
_______________________________________________
QL-Users Mailing List