Group pj_assert

group pj_assert

Assertion and other helper macros for sanity checking.

Defines

pj_assert(expr)

Check during debug build that an expression is true. If the expression computes to false during run-time, then the program will stop at the offending statements. For release build, this macro will not do anything.

Parameters
  • expr – The expression to be evaluated.

PJ_ASSERT_RETURN(expr, retval)

If PJ_ENABLE_EXTRA_CHECK is declared and the value is non-zero, then PJ_ASSERT_RETURN macro will evaluate the expression in expr during run-time. If the expression yields false, assertion will be triggered and the current function will return with the specified return value.

If PJ_ENABLE_EXTRA_CHECK is not declared or is zero, then no run-time checking will be performed. The macro simply evaluates to pj_assert(expr).

PJ_ASSERT_ON_FAIL(expr, exec_on_fail)

If PJ_ENABLE_EXTRA_CHECK is declared and non-zero, then PJ_ASSERT_ON_FAIL macro will evaluate the expression in expr during run-time. If the expression yields false, assertion will be triggered and exec_on_fail will be executed.

If PJ_ENABLE_EXTRA_CHECK is not declared or is zero, then no run-time checking will be performed. The macro simply evaluates to pj_assert(expr).