duncanb@ibmpcug.co.uk (D G Booth) (03/10/90)
There was a paper about exception handling in C in Software Practice and
Experience back about 1981 (sorry, I dont have the exact reference on me).
That handled exceptions with code like:
exception FILE_ERROR;
...
BEGIN
f = fopen("afile", "r");
if (f == NULL) exc_raise(FILE_ERROR);
... normal case code.
EXCEPTION
WHEN(FILE_ERROR)
... handle file error
WHEN(OTHERS)
... handle other errors.
exc_reraise(); /* Pass exception out to next level */
END
I have been using this code (with a few minor changes of my own)
for some time. It is neat and quite clean.
--
Automatic Disclaimer:
The views expressed above are those of the author alone and may not
represent the views of the IBM PC User Group.
--
---
Duncan Booth, RCP Ltd. Didcot, Oxon, UK
duncanb@ibmpcug.co.uk Bix: jrichards