File:  [MW Coherent from dump] / coherent / a / usr / man / ALL / assert
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:34 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent



assert()                      Macro                      assert()




Check assertion at run time

#include <assert.h>
vvooiidd aasssseerrtt(_e_x_p_r_e_s_s_i_o_n) iinntt _e_x_p_r_e_s_s_i_o_n;

assert checks  the value of  expression.  If expression  is false
(zero), assert sends a message into the standard-error stream and
calls exit.   It is  useful for  verifying that a  necessary con-
dition is true.

The error message includes the text of the assertion that failed,
the name of the source file,  and the line within the source file
that holds  the expression in question.   These last two elements
consist, respectively,  of the values of  the preprocessor macros
_ _FILE_ _ and _ _LINE_ _.

assert calls exit, which never returns.

To turn  off assert, define  the macro NDEBUG  prior to including
the header assert.h.  This forces assert to be redefined as


        #define assert(ignore)


***** See Also *****

exit(), assert.h, C preprocessor

***** Notes *****

The Standard requires that  assert be implemented as a macro, not
a library function.  If a program suppresses the macro definition
in favor of a function call, its behavior is undefined.

Turning off assert with the macro NDEBUG will affect the behavior
of a program if the expression being evaluated normally generates
side effects.

assert  is useful  for debugging, and  for testing  boundary con-
ditions for  which more graceful error recovery  has not yet been
implemented.














COHERENT Lexicon                                           Page 1



unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.