ASSERT

Section: C Library Functions (3)
Index Return to Main Contents

BSD mandoc
 

NAME

assert - expression verification macro  

SYNOPSIS

Fd #include <assert.h> Fn assert expression  

DESCRIPTION

The Fn assert macro tests the given expression and if it is false, the calling process is terminated. A diagnostic message is written to stderr and the abort(3) function is called, effectively terminating the program.

If expression is true, the Fn assert macro does nothing.

The Fn assert macro may be removed at compile time with the cc(1) option -DNDEBUG  

DIAGNOSTICS

The following diagnostic message is written to stderr if expression is false:
"assertion \"%s\" failed: file \"%s\", line %d\n", \
                    "expression", __FILE__, __LINE__);
 

SEE ALSO

cc(1), abort(3)  

STANDARDS

The Fn assert macro conforms to St -ansiC .  

HISTORY

A assert macro appeared in AT&T System v6 .


 

Index

NAME
SYNOPSIS
DESCRIPTION
DIAGNOSTICS
SEE ALSO
STANDARDS
HISTORY

This document was created by man2html, using the manual pages.
Time: 21:44:10 GMT, August 05, 2022