Symbian
 Developer Library

UIQ 3 SDK

UIQ developer portal

FEEDBACK 

[Index] [Spacer] [Previous] [Next]



Location: e32def.h

__ASSERT_ALWAYS

__ASSERT_ALWAYS (c, p) (void)((c)||(p,0))

Description

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;

Parameters

c

a conditional expression which results in true or false.

p

a function which is called if the conditional expression c is false.

See also:

Terms and conditions of use of the material