DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SCO OpenServer

ASSERT(D3oddi)


ASSERT -- verify assertion

Synopsis

   #include <sys/debug.h>
   

void ASSERT(int expression);

Description

ASSERT is a debugging interface for verifying program invariants within code that is compiled with the DEBUG compilation option defined.

Arguments


expression
Expression to be evaluated. This is a boolean expression that the caller expects to evaluate to non-zero (that is, the caller is asserting that the expression has a non-zero value). If expression evaluates to non-zero, the ASSERT call has no effect.

Return values

If expression evaluates to non-zero, ASSERT returns no value. If expression evaluates to 0, ASSERT panics the system.

Usage

If expression evaluates to zero, ASSERT causes the system to panic with the following message:
   PANIC: assertion failed: expression, file: filename, line: lineno

where filename is the name of the source file in which the failed assertion appears and lineno is the line number of the ASSERT call within the file.

When the DEBUG compilation option is not defined, ASSERT calls are not compiled into the code, and therefore have no effect, including the fact that expression is not evaluated.

Drivers can use the calldebug(D3oddi) function to invoke the kernel debugger in other cases.

Context and synchronization

All contexts.

Hardware applicability

All

Version applicability

oddi: 1, 2, 2mp, 3, 3mp, 4, 4mp, 5, 5mp, 6, 6mp

References

calldebug(D3oddi), cmn_err(D3oddi)

``Coding the driver for debugging'' in Developing device drivers


19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 5 HDK - June 2005