DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SVR5

ASSERT(D3)


ASSERT -- verify assertion

Synopsis

   #include <sys/debug.h>
   #include <sys/ddi.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.

Return values

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

Usage

expression 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. 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.

Use the ASSERT( ) function to check that the value of variables and structure members is correct at various stages of execution. ASSERT( ) evaluates a simple expression and, if it is not true, panics the system at that point so you can use a kernel debugger or crash to analyze the kernel. ASSERT(D3) is ignored except when the driver is compiled with the -DDEBUG flag.

Context and synchronization

All contexts.

Hardware applicability

All

Version applicability

ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp

References

cmn_err(D3)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005