Article View: comp.sys.acorn.tech
Article #111Error trapping in C
From: burke
Date: Thu, 06 Aug 1992 19:11
Date: Thu, 06 Aug 1992 19:11
21 lines
1738 bytes
1738 bytes
What do you need to do to make a C program bomb-proof? You obviously have to catch SIGSTAK, but is it possible to get SIGINT or SIGTERM? If so, how? The C manual isn't very forthcoming about signals. Also, does wimpt_noerr() stop the program with exit() or abort()? Secondly, what should I do after a signal? Presumably a longjmp to the main routine is the best bet, but what then - after a SIGSTAK, will it be safe to call saveas()? Or I could save to an internal file and then quit, but what if the save fails? Or I could put up a message and just go back to polling, but will all the internal data structures be intact? (and you may just get SIGSTAK again anyway). Acorn are always going on about how you shouldn't die with unsaved data, and then they give you a system whose response to running out of memory is to collapse with a backtrace, and no guidance on how to do it better :-( Any ideas? e----><----p | Stephen Burke | Internet: burke@vxdesy.desy.de H H 1 | Gruppe FH1T (Liverpool) | DECnet: vxdesy::burke (13313::burke) H H 11 | DESY, Notkestrasse 85 | BITNET: BURKE@DESYVAX or SB2@UKACRL HHHHH 1 | 2000 Hamburg 52 | JANET: sb2@uk.ac.rl.ib H H 1 | Germany | Phone: + 49 40 8998 2282 H H 11111 | HERA, the world's largest electron microscope!
Technical Details
Message-ID:
<1992Aug6.191108.1@vxdesy.desy.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!dxcern!dscomsa.desy.de!vxdesy.desy.de!burkeShow Full Headers
Complete Article Headers
Newsgroups: comp.sys.acorn.tech Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!dxcern!dscomsa.desy.de!vxdesy.desy.de!burke From: burke@vxdesy.desy.de Subject: Error trapping in C Message-ID: <1992Aug6.191108.1@vxdesy.desy.de> Lines: 21 Sender: news@dscomsf.desy.de (USENET News System) Nntp-Posting-Host: vxdsyc.desy.de Organization: (DESY, Hamburg, Germany) Date: Thu, 6 Aug 1992 19:11:08 GMT