Next: , Previous: Library Routines, Up: Library Routines


3.1 tf_assert

program verification

Synopsis

     #include <tracefct.h>
     
     
     
tf_assert(expression); tf_assert1(expression); tf_assert2(expression); tf_assert3(expression); tf_assert4(expression); tf_assert5(expression);

Parameters

expression
A standard C expression.

Description

The tf_assert routines are C preprocessor macros that indicate that expression is expected to be true at the point in the program that the macros are invoked. If expression is false, a diagnostic message is printed to stderr indicating the file and line number at which the assertion failed, and the program exits.

Unlike the standard assert macro, tf_assert is always valid. The other routines are valid depending upon the value of the preprocessor macro TF_ASSERT_LEVEL. The macro tf_assertn is valid if `TF_ASSERT_LEVEL >= n'. By default, TF_ASSERT_LEVEL is undefined (equivalently set to `0'). This setup provides a compile time choice of diagnostic output.

The benefit of these routines over the standard assert macro is that they use the tracefct standard output format.