Hello there I am quite new to FreeBASIC. I am experiencing a problem with arrays. In particular, if I happen to try and make access to an invalid array index (e.g. I go past the last element on an array), I get no error in compilation. What's more, the program just silently crashes when I try to run it. I can usually catch this issue, but I was wondering, is there a way to get an error message on compilation (very unlikely maybe) or during runtime?
Thanks a lot.
No runtime error when accessing an invalid index on an array
Re: No runtime error when accessing an invalid index on an array
Compile with the flag -exx on the command line. This will throw some runtime errors.
Re: No runtime error when accessing an invalid index on an array
In order to prevent "out of bounds" errors, on array access, there are:
LBound(a) and, UBound(a)
where a, is the array identifier ... (without bounds specifiers!)
LBound(a) and, UBound(a)
where a, is the array identifier ... (without bounds specifiers!)