GNU Nana is a free library providing improved support for assertion checking (as in assert.h) and logging (printf style debugging) in GNU C and C . Features:
- Space/time efficient, at least compared to assert.h. For example assert(i >= 0) uses 53 bytes on the x86, while Nana uses either 10 bytes or 1.
- Support for predicate calculus (``for all,'' ``exists,'' and so on) is provided using both C style for loops and C STL iterators over container classes.
- Assertions can refer to saved state; for exaple, the return value of a sort function can be checked against the arguments on function entry.
- Logging messages can be redirected to a variety of destinations including files, processes (for automated testing or visualisation) or circular buffers in core.
- Assertions about time can be made in a simple manner.
- Lists of invariant checking or printing functions can be created which can then be called to check internal consistency or display state.
- All of the features can be selectively enabled or disabled at both compile and run time.