1: /* assert.h */ 2: 3: #ifndef NDEBUG /* 8086 must do without training wheels. */ 4: #define NDEBUG (_WORD_SIZE == 2) 5: #endif 6: 7: #if !NDEBUG 8: 9: #define INIT_ASSERT static char *assert_file= __FILE__; 10: 11: void bad_assertion(char *file, int line, char *what); 12: void bad_compare(char *file, int line, int lhs, char *what, int rhs); 13: 14: #define assert(x) (!(x) ? bad_assertion(assert_file, __LINE__, #x) \ 15: : (void) 0) 16: #define compare(a,t,b) (!((a) t (b)) ? bad_compare(assert_file, __LINE__, \ 17: (a), #a " " #t " " #b, (b)) : (void) 0) 18: #else /* NDEBUG */ 19: 20: #define INIT_ASSERT /* nothing */ 21: 22: #define assert(x) (void)0 23: #define compare(a,t,b) (void)0 24: 25: #endif /* NDEBUG */