# C Programming/Code library

The following is an implementation of the Standard C99 version of
`<assert.h>`:

``` c
 /* assert.h header */
 #undef assert
 #ifdef NDEBUG
 #define assert(_Ignore) ((void)0)
 #else
 void _Assertfail(char *, char *, int, char *);
 #define assert(_Test) ((_Test)?((void)0):_Assertfail(#_Test,__FILE__,__LINE__,__func__))
 #endif
 /* END OF FILE */
```

``` c
 /* xassertfail.c -- _Assertfail function */
 #include <stdlib.h>
 #include <stdio.h>
 #include <assert.h>
 void
 _Assertfail(char *test, char *filename, int line_number, char *function_name)
 {
    fprintf(stderr, "Assertion failed: %s, function %s, file %s, line %d.",
            test, function_name, filename, line_number);
    abort();
 }
 /* END OF FILE */  
```

