Path: utzoo!attcan!uunet!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.c Subject: Re: error handling techniques? Message-ID: <4246@goanna.cs.rmit.oz.au> Date: 12 Nov 90 07:23:27 GMT References: <1990Nov2.205831.23696@elroy.jpl.nasa.gov> <234@smds.UUCP> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 23 In article <234@smds.UUCP>, rh@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.