Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 (MC830713); site edai.UUCP Path: utzoo!linus!philabs!cmcl2!floyd!vax135!ukc!edcaad!edee!edai!ok From: ok@edai.UUCP (Richard O'Keefe) Newsgroups: net.sources Subject: A version of assert.h which abort()s Message-ID: <4126@edai.UUCP> Date: Tue, 10-Apr-84 19:27:16 EST Article-I.D.: edai.4126 Posted: Tue Apr 10 19:27:16 1984 Date-Received: Fri, 13-Apr-84 01:42:45 EST Organization: Art.Intelligence,Edin.Univ. Lines: 15 I've never found assert(3X) very useful as a debugging tool, as when an assertion fails, I'd like to get a core dump so I can poke around with sdb or adb. This version calls abort() instead of calling exit(1). cat >assert.h <<'EOF' #if NDEBUG # define assert(expression) {} #else ~NDEBUG # define assert(expression) {if (!(expression)) {\ fprintf(stderr,"Assertion failed: file %s, line %d\n",\ __FILE__, __LINE__);\ abort();}} #endif NDEBUG 'EOF'