-

Functions HI-TECH C ASSERT

From HI-TECH C for CP/M Fan WIKI(EN)
Jump to: navigation, search

ASSERT

SYNOPSIS

#include  <assert.h>

void      assert(int e)


DESCRIPTION

This macro is used for debugging purposes; the basic method of usage is to place assertions liberally throughout your code at points where correct operation of the code depends upon certain conditions being true initially. An assert() may be used to ensure at run time that that assumption holds. For example, the following statement asserts that the pointer tp is non-null:

assert(tp);

If at run time the expression evaluates to false, the program will abort with a message identifying the source file and line number of the assertion, and the expression used as an argument to it. A fuller discussion of the uses of assert is impossible in limited space, but it is closely linked to methods of proving program correctness.