Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Eric Sosman <esosman@ieee-dot-org.invalid> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: C error messages |
| Date | 2011-09-22 21:21 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <j5gmvb$f6b$1@dont-email.me> (permalink) |
| References | <j5dh8j$dim$1@speranza.aioe.org> <87vcslljk9.fsf@blp.benpfaff.org> <j5g82k$v57$1@speranza.aioe.org> |
On 9/22/2011 5:07 PM, Quentin Pope wrote:
> Thanks Ben.
>
> Would you say then that a Bus Error is a showstopper but a Segmentation
> Fault is less serious, so it would be worth catching that signal, maybe
> writing a message to a log file, but then continuing with the program?
No. Both are evidence that your program has followed a bad
pointer (or bad array index), meaning that your code can no longer
trust its data. If you "recover" from either fault, what reason
have you to believe that any subsequent `if' will go in the right
direction? What degree of trust can you place in the program's
actions or output? The C Standard says that continuing from this
sort of signal yields undefined behavior; I believe (could be wrong
here) that POSIX says much the same thing. There is very little,
very very little, that can be done reliably after such an event.
Poor analogy, but maybe it gets the right flavor: After entrusting
your retirement savings to a financial advisor, you happen to catch
said advisor embezzling from your accounts. Do you write a message to
a log file and keep on going, or do you do something more drastic?
--
Eric Sosman
esosman@ieee-dot-org.invalid
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
C error messages Quentin Pope <qp19433@hotmail.NOSPAM.com> - 2011-09-21 20:25 +0000
Re: C error messages blp@cs.stanford.edu (Ben Pfaff) - 2011-09-21 13:36 -0700
Re: C error messages Quentin Pope <qp19433@hotmail.NOSPAM.com> - 2011-09-22 21:07 +0000
Re: C error messages blp@cs.stanford.edu (Ben Pfaff) - 2011-09-22 14:34 -0700
Re: C error messages Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2011-09-22 16:05 -0600
Re: C error messages Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-09-22 21:21 -0400
Re: C error messages Nobody <nobody@nowhere.com> - 2011-09-22 18:08 +0100
Re: C error messages Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-09-23 12:00 +0300
csiph-web