C-Debug package ... (a la "context-independent macros")

Alan Green aug at cybvax0.UUCP
Mon Feb 4 09:00:05 AEST 1985


> Okay, folks, we've discussed this one before.  The macro
> 
> #define assert(x) if (!(x)) die_miserably("x bombed\n")
> 
> doesn't work because of problems with a missing else.  It was suggested
> ...

Whats wrong with:

#define assert(cond)	( (cond) ? 0 : \
			    (fprintf (stderr, \
				"assertion failed at line %d in file %s\n", \
					__LINE__, __FILE__), \
			     exit(-1) \
			    ) \
			)

	???


					harvard!cybvax0!aug



More information about the Comp.lang.c mailing list