Exception not thrown when index greater than array

BlitzMax Forums/BlitzMax Programming/Exception not thrown when index greater than array

wookie(Posted 2011) [#1]
Simple code:

Local ar%[5]
If ar[7]=2 Then Print "ooo"

When running in normal mode no exception is thrown. Everything is OK in debug mode.

Is it normal behavior ?


Michiel(Posted 2011) [#2]
Yep. Ran into the same problem and found some posts indicating that Blitzmax does report the index out of bounds error in debug mode, but not in non-debug mode. So it seems to be by design.


Czar Flavius(Posted 2011) [#3]
Yes. Bounds checking slows the array down a bit, so it is disabled in release mode. Your program code shouldn't rely on it. You will need your own check or access function if you always want a bounds check.