Managing error strings in C

Glenn Amerine gamerine at bluemoon.uucp
Sat Jan 12 00:58:06 AEST 1991


blambert at lotus.lotus.com (Brian Lambert) writes:

> Hi:
> 
> I was wondering if anyone out there had any clever ways of handling
> error messages in C.  That is, in small/medimum size programs one
> usually winds up with all sorts of:
> 
>     PrintLog("Memory allocation error");

The C Users Group had a real nifty way of doing this with conditional
macros to either get the value macro or the message macro, but I
tossed it on my "neat-stuff-I-gotta-try" stack and can't find it
right now. I'll look for it for you if you want.
The thing that really struck me as neat about the method is that it is
very easy to keep the right error values with the right error messages.

Glenn



More information about the Comp.lang.c mailing list