Error Handling

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Jan van de Poll

Error Handling

Post by Jan van de Poll »

Hi all

Using PDS 7.1 + MASM on Dos boxes
Trying to come up with an alternative to the "ON ERROR"
Currently every routine has the following,

'---------------------------------
Sub SomeName
OldRoutine = Routine
Routine = 1234
'
' body of routine
'
'
Routine = OldRoutine
End Sub
'---------------------------------
So when an error happens, I know where it happens and can select the
correct response.

My trouble is the overhead and speed degradation caused by basic's error
handling.Speed is very important as I am running up to 50 processes
at one time.

I have experimented with various methods, but none give the kind of
improvement that I am looking for. For example if I run my program with
all error handling disabled, the program runs faster.

So, one idea would be if I intercepted the dos error handler that causes the
program to halt and use a lookup (table or file) to see where the error
happened.

I know many programmers use extensive error checking at each instruction that can cause an error,
but that will create an enormous amount of overhead.
Of course I check for errors at the obvious file open's etc.

Does anybody have any ideas on this. I dont want written code, just ideas.

Regards from down under.
Guest

Post by Guest »

I think there is a funtion called errdev$ and err..something$ that return some stuff about errors. If no errors have occured, I bet they return a null string. Look on help.
Jan van de Poll

Error Handling

Post by Jan van de Poll »

The trouble with that is:
1. You still need basic's error handling enabled.
2. To use ERL$ you have to have line numbers(which I havent done for 20 years)
MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows »

I think the best thing you could, and it would still require QB's error handling to be on, is to trap all errors and send them to your handler. The QB's error handler would only be used to throw any and all errors to your error manager. Unless you modify QB's runtime library itself.
When God created light, so too was born, the first Shadow!

MystikShadows

Need hosting? http://www.jc-hosting.net

Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
Post Reply