exception handling in C
D G Booth
duncanb at ibmpcug.co.uk
Sat Mar 10 18:54:09 AEST 1990
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 at ibmpcug.co.uk Bix: jrichards
More information about the Comp.lang.c
mailing list