Visit Our UNIX and Linux User Community

Linux and UNIX Man Pages

Test Your Knowledge in Computers #799
Difficulty: Medium
In digital numeral systems, the radix is the number of unique digits minus 1.
True or False?
Linux & Unix Commands - Search Man Pages

_diagassert(3) [netbsd man page]

_DIAGASSERT(3)						   BSD Library Functions Manual 					    _DIAGASSERT(3)

_DIAGASSERT -- expression verification macro SYNOPSIS
#include <assert.h> _DIAGASSERT(expression); DESCRIPTION
The _DIAGASSERT() macro tests the given expression and if it is false, one or more of the following may occur: o a diagnostic message may be logged to the system logger with syslog(3). This is default behaviour. o a diagnostic message may be printed to the stderr stream. o the calling process will be terminated by calling abort(3). This behaviour may be changed by setting the LIBC_DIAGASSERT environment variable (see below). The diagnostic message consists of the text of the expression, the name of the source file, the line number and the enclosing function. If expression is true, the _DIAGASSERT() macro does nothing. The _DIAGASSERT() macro is not compiled in by default, and will only be compiled in with the cc(1) option -D_DIAGNOSTIC. This macro is used in the various system libraries such as the Standard C Library (libc, -lc) to ensure that various library calls are invoked with valid arguments. ENVIRONMENT
The LIBC_DIAGASSERT environment variable can be used to modify the default behaviour of logging the assertion to the system logger. LIBC_DIAGASSERT may be set to one or more of the following characters: a abort(3) once any assertion messages have been logged and/or printed. A Opposite of ``a''. e Print the assertion message to the stderr stream. E Opposite of ``e''. l Log the assertion message with syslog(3) to the facility user.debug. L Opposite of ``l''. DIAGNOSTICS
The diagnostic message has the following format: "assertion "%s" failed: file "%s", line %d, function "%s" ", "expression", __FILE__, __LINE__, __func__ SEE ALSO
cc(1), abort(3), assert(3), syslog(3) HISTORY
The _DIAGASSERT macro appeared in NetBSD 1.5. BSD
January 22, 2007 BSD

Check Out this Related Man Page

ASSERT(3P)						     POSIX Programmer's Manual							ASSERT(3P)

This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
assert - insert program diagnostics SYNOPSIS
#include <assert.h> void assert(scalar expression); DESCRIPTION
The assert() macro shall insert diagnostics into programs; it shall expand to a void expression. When it is executed, if expression (which shall have a scalar type) is false (that is, compares equal to 0), assert() shall write information about the particular call that failed on stderr and shall call abort(). The information written about the call that failed shall include the text of the argument, the name of the source file, the source file line number, and the name of the enclosing function; the latter are, respectively, the values of the preprocessing macros __FILE__ and __LINE__ and of the identifier __func__. Forcing a definition of the name NDEBUG, either from the compiler command line or with the preprocessor control statement #define NDEBUG ahead of the #include <assert.h> statement, shall stop assertions from being compiled into the program. RETURN VALUE
The assert() macro shall not return a value. ERRORS
No errors are defined. The following sections are informative. EXAMPLES
abort(), stderr, the Base Definitions volume of IEEE Std 1003.1-2001, <assert.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at . IEEE
/The Open Group 2003 ASSERT(3P)

Featured Tech Videos