Qbasicnews.com

Full Version: Another bug or did I get smth wrong?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
sub test(byref i as any ptr)
   i=7856
   print i
   end sub
dim k as any ptr
test k
print k
sleep
if pointer is declared as any, or pointer to type, then byref doesn't work. everywehere else does.
heh, more bugs:
Code:
option base 10
dim s(10) as integer
print lbound(s)
print ubound(s)
sleep
there are few things -shouldn't it be, if I specify in Dim array Size, not the upper bound?, and if I use option base 10(is it legal at all? Lbound gives the currect answer) then shouldn't the upperbound become 20? instead of 10? and also give an error if I try to write/access to out of bound array element?
No, FB's DIM already matches QB exactly. QB/FB DIM syntax:
Code:
DIM array(lowBound TO highBound)
Or:
Code:
OPTION BASE lowBound
DIM array(highBound)
Fixed, will be on the next release, thanks.

Quote:[fixed] ptr params passed byref to functions were being converted, as IR wasn't treating POINTER dtypes as UINT (v1c)



Quote:and also give an error if I try to write/access to out of bound array element?

There's no bounds checking yet, maybe on next versions.. also the ugly-and-bad math overflow checking ;). OPTION BASE can be anything too, not restrited to 0 or 1.. hey, call that an useless feature.
How about a compile option to turn runtime error checking off for that extra speed?
-noerror

Or even a metacommand, so you can turn it on and off as you like in your code?

Hard coded math doesent really need error checking does it, but it would be kind of hard for the compiler to know whats hard coded and whats userinput, especially on large programs.

'$checkerror [1 | 0]
?
Error checking won't be enabled by default, otherwise FB apps would be slower than QB ones ;)

Checks will probably be added if you keep the debug symbols, using the -g option.
Okay, did I get smth wrong or it is another bug?

Code:
for i=1 to 100
   for j =1 to 10
      continue j
      print j
   next j
next i

sleep

what does continue keyord do?
sry, my bad. figured out: continue do, continue for.

But could you do it like: "continue for i" <-if nested for next, then set to witch for it will go?