ok@edai.UUCP (Richard O'Keefe) (04/11/84)
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'