error handling techniques?

Richard A. O'Keefe ok at goanna.cs.rmit.oz.au
Mon Nov 12 18:23:27 AEST 1990


In article <234 at smds.UUCP>, rh at smds.UUCP (Richard Harter) writes:
> The code maintains a history of the last 128 function calls in a circular
> buffer; this information is dumped in the error report.

I wouldn't mind doing something like this, but how do you do it?
Have you a set of macros to ease the job, or what?
Is _every_ function call included, or only selected ones?
I tend to write recursive code, the trouble with that is that
when things go wrong all the calls in the buffer tend to be to
the same function (or a small set of mutually recursive functions),
have you found a good way around that?

Something I've done from time to time when procedure calls had to be
sequenced carefully (e.g. a program that generated Fortran code was
not to call place_label() twice without an intervening end_statement())
was to have a DFA transition table for that kind of object and have
the relevant functions do
	if (!permitted_operation[object->state][THISFN]) error(...);
	object->state = next_state[object->state][THISFN];

-- 
The problem about real life is that moving one's knight to QB3
may always be replied to with a lob across the net.  --Alasdair Macintyre.



More information about the Comp.lang.c mailing list