friendly messages

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Mar 3 22:05:29 AEST 1989


In article <1369 at dsacg3.UUCP> vfm6066 at dsacg3.UUCP (John A. Ebersold) writes:
-How many times has anyone heard (or said) something like.  "I'm not checking
-the return value becuase I can't do anything about it anyway."
-To me, this is not true.  You can always print a message that says:
-Horrible error in program foo, function bar, the function bletch returned a
--1 on about line x.
-I'd rather have this than a mysterious failure.

I agree with you in general; however, there's one common case where the
best solution seems to be to ignore the failure:  when an attempt to
output an error message (to stderr, usually) fails.  What are you going
to do, try to print yet another error message?

The "assert" macro defined by "#include <assert.h>" is very handy for
handling program logic bugs, in many cases.  Sometimes it is important
to try to recover from an error and resume normal operation, rather
than terminating the process.



More information about the Comp.unix.wizards mailing list