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 only log the assertion, while the program continues running.

Parameters:
  • expr – The expression to be evaluated.

PJ_ASSERT_LOG(expr, ...)

For all builds, log the message. 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 only print message on the log.

Parameters:
  • expr – The expression to be evaluated.

  • ... – File name. The format string for the log message (“config.c”, “ PJ_VERSION: %s”, PJ_VERSION)

PJ_ASSERT_RETURN(expr, retval)

If the expression yields false, assertion will be triggered and the current function will return with the specified return value.

PJ_ASSERT_ON_FAIL(expr, exec_on_fail)

If the expression yields false, assertion will be triggered and exec_on_fail will be executed.