Subject: Re: sanity checking arguments to library functions...
To: Guenther Grau <Guenther.Grau@bk.bosch.de>
From: Julian Assange <proff@iq.org>
List: tech-userlevel
Date: 04/16/1999 23:46:48
Guenther Grau <Guenther.Grau@bk.bosch.de> writes:

> > the method of highlighting failure, so i suggest that the following
> >                 - syslog "function __file__ __line__ ..." (my preferred ;)
> >         * have the failure mode one of:
> >                 - dump core using abort() (my preferred ;)

This is what I use:

#define assert(x) \
do\
{\
	if (!(x))\
		{\
			syslog(LOG_ERR, "%s:%d:%s() failed assertion: %s\n", __FILE__, __LINE__, __FUNCTION, #x);\
			abort();\
		}\
} while (0)