GNU Nana: improved support for assertion checking and logging in
GNU C/C++
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++. It provides
support for some of the ideas of Eiffel, VDM, Z and Anna in GNU C/C++.
GNU Nana was developed by Phil Maker.
For full documentation, see the online manual available at www.gnu.org/software/nana/manual/nana.html.
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.
Why is this useful?
- The sooner an error is detected, the cheaper it is to
fix. Error correction is a (the) major cost in software development.
- Recording what the system is doing before it goes off into
``never never land'' is very useful.
- ``This style (Design by Contract) of analysis avoids a classic
dilemma of analysis and specification: either you use a programming
notation and run the risk of making premature implementation
commitments; or you stick with a higher level notation (``bubbles and
arrows'') and you must remain vague, forsaking one of the major
benefits of the analysis process, the ability to state and clarify
delicate properties of the system'' - ISE Inc.
Mailing list?
The mailing list for discussion of Nana is <nana@it.ntu.edu.au>;
you can subscribe automatically by mailing to
<nana-request@it.ntu.edu.au>.
Return to GNU's home page.
Please send FSF & GNU inquiries & questions to
gnu@gnu.org.
There are also other ways to
contact the FSF.
Please send comments on these web pages to
webmasters@www.gnu.org,
send other questions to
gnu@gnu.org.
Copyright (C) 1997, 1998 Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111, USA
Verbatim copying and distribution of this entire article is
permitted in any medium, provided this notice is preserved.
Updated:
Last modified: $Date: 2003/10/28 20:27:22 $ $Author: sinuhe $