Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!apple!ames!ncar!mephisto!bloom-beacon!eru!luth!sunic!mcsun!ukc!slxsys!ibmpcug!duncanb From: duncanb@ibmpcug.co.uk (D G Booth) Newsgroups: comp.lang.c,connect.audit Subject: Re: exception handling in C Message-ID: <1990Mar10.085409.8995@ibmpcug.co.uk> Date: 10 Mar 90 08:54:09 GMT Organization: The IBM PC User Group, UK. Lines: 29 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