hellomike wrote: ↑
Fri 08 Nov 2019, 20:30
I thought Richard would like to be aware of it.
I am. You may be surprised to learn that it happens 'by design'.
In the 'old days', before the introduction of labels in BB4W and BBCSDL, the only valid destination of a GOTO, GOSUB or RESTORE was a line number, which must be in the range 1-65535. So before labels existed 'GOTO -1' was equivalent to 'GOTO 65535' and wouldn't crash. But with labels any value is accepted and if outside the range 1-65535 is assumed to be the address of a label in your program.
If you know about such things, you will be aware that 'address validation', that is determining whether an address corresponds to 'real' (accessible) memory or not, isn't straightforward. Raymond Chen, the Microsoft guru and blogger
, takes the view that the easiest and safest way to deal with an invalid address is to allow your program to crash
, so I do!
One of the advantages of BBCSDL over BB4W is that the IDE and the user's BASIC program(s) run in separate processes, so are isolated from one another by the OS. However catastrophically a BASIC program crashes, it should not be possible for it to bring down the IDE. Of course crashing may not be the best thing to do from the point of view of debugging - it can make finding the cause of the fault more difficult.
I could treat -1 as a special case, since it's highly unlikely to be the address of a label, but currently my interpreters accept all values. If you use GOTOs in your programs you deserve everything you get...
My posts are moderated; if you are seeing this it has already been approved. If you have a comment about the style or tone of the message please report it to the moderators by clicking the exclamation mark icon rather than complaining on the public forum.