PreviousNext

dce_assert(3dce)

Inserts program diagnostics

Synopsis

#define DCE_ASSERT

#include <dce/assert.h>

void dce_assert(

dce_svc_handle_t handle,

int expression);

Parameters

Input

handle
A registered serviceability handle.

expression
An expression the truth of which is to be tested.

Description
The dce_assert macro is used to add runtime can't happen assertions to programs (that is, programming errors). On execution, when expression evaluates to 0 (that is, to false), then dce_svc_printf( ) is called with parameters to generate a message identifying the expression, source file and line number. The message is generated with a severity level of svc_c_sev_fatal, with the svc_c_action_abort flag specified (which will cause the program to abort when the assertion fails and the message is generated). See the dce_svc_register(3dce) reference page for more information.

The handle parameter should be a registered serviceability handle; it can also be NULL, in which case an internal serviceability handle will be used.

Assertion-checking can be enabled or disabled at compile time. The header file dce/assert.h can be included multiple times. If DCE_ASSERT is defined before the header is included, assertion checking is performed. If it is not so defined, then the assertion-checking code is not compiled in. The system default is set in dce/dce.h.

Errors

The following describes a partial list of errors that might be returned. Refer to the OSF DCE Problem Determination Guide for complete descriptions of all error messages.

See dce_svc_register(3dce).

Related Information
Functions: dce_svc_register(3dce)