Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: e32def.h
Link against:

__ASSERT_ALWAYS

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

Support

Supported from 5.0

Description

Assert that a condition is true 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 results in a panic.

Note:

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: