Managing error strings in C

Brad Appleton brad at SSD.CSD.HARRIS.COM
Wed Jan 23 03:08:40 AEST 1991


Just wanted to add my $.02 ...

So far, All Ive seen on this thread talks only  about associating text, and a
unique number to an error as in:

  { EFOO, "unable to foo" },
          .
          .
          .

The stuff on parameter expansion/substitution in the format string is
interesting, however I believe one more thing should be included as part
of the "error" object - namely a severity (or level), as in:


  { EFOO, WARNING, "unable to foo" },
          .
          .
          .

The most common severity types are:
   1) Diagnostic (information messages only)
   2) Warnings
   3) Non-Fatal Errors
   4) Fatal Errors

I have also seen more "severity" levels used by adding an element of
user control to Warnings and Non-fatal errors such as, conditionally prompting
to continue or forcing termination after warnings and/or non-fatal errors
(such behavior may have been specified on the command-line and/or in an 
environment variable).

I think it is important to have some sense of severity associated with the
error in addition to its text and its id! As to the kind and number of 
severities or levels, that by itself is a worthy topic for discussion!

______________________ "And miles to go before I sleep." ______________________
 Brad Appleton           brad at ssd.csd.harris.com       Harris Computer Systems
                             uunet!hcx1!brad           Fort Lauderdale, FL USA
~~~~~~~~~~~~~~~~~~~~ Disclaimer: I said it, not my company! ~~~~~~~~~~~~~~~~~~~



More information about the Comp.lang.c mailing list