yeah... it's really very limited where it can be used, like might be better to just call it broken so no one gets their hopes up.
"ON ERROR goto LABEL" saves the address of the LABEL to jump to on error
"ERROR n" unconditionally jumps to LABEL
For it to work, need to stay within the same stack frame.
If "ERROR n" is called from a sub procedure it's likely going to be jumping to code from a different stack frame.
Even if using something like a setjmp/longjmp to handle the stack issues, destructors don't get called, or temporary memory not on stack doesn't get freed.
To make it work, it's a lot more to add behind the scenes. Or add exception handling, though the code-flow is a little different than ON ERROR/RESUME ...
Basic-Macros in fbc 1.08
Re: Basic-Macros in fbc 1.08
Something like Try/Catch/Finally?coderJeff wrote:Or add exception handling, though the code-flow is a little different than ON ERROR/RESUME ...
Code: Select all
Try
n=n/0
Print "div failed, but you won't see this message because we implemented SEH"
Catch
MsgBox 0, "div failed", "You will see this message only on error", MB_OK
Finally
print "that was tough, now let's continue"