|
|
|
|
Location:
e32def.h
__ASSERT_ALWAYS (c, p) (void)((c)||(p,0))
Asserts that a condition is true.
Code is generated for all builds.
This macro is used as a C++ statement to assert the truth of some condition, and to take appropriate action if the condition is false. Unlike __ASSERT_DEBUG it is defined in both release and debug builds.
The most common use for this macro is to check that the external environment of a function or class is behaving as expected; for example, that parameters passed to a function are credible, or that called functions are behaving as expected; the macro is commonly placed at the beginning of a function.
The effect of the macro is to generate code which tests the conditional expression c; if the expression is false, then function p is called. In the majority of cases, the function p is one that raises a panic.
Note that the macro definition is, in effect, equivalent to:
if !(c)p;
|
__ASSERT_DEBUG