Better error message for un-dimed array

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Better error message for un-dimed array

Post by Dude »

This (runnable!) code produces an "Invalid memory access" error:

Code: Select all

Dim a$(10)
FreeArray(a$())

; ... Imagine lots of code here, so you forget FreeArray() was used ...

a$(1)="test" ; Invalid memory access error. User wonders why?
This error message, while technically correct, is not very helpful when trying to debug your code.

Surely the error message could be something more user-friendly like: "Array has not been Dim'ed."