__assert_fail

Name

__assert_fail -- abort the program after false assertion

Synopsis

void __assert_fail(const char * assertion, const char * file, unsigned int line, const char * function);

Description

The __assert_fail() function is used to implement the assert() interface of POSIX 1003.1-2001 (ISO/IEC 9945-2003). The __assert_fail() function shall print the given file filename, line line number, function function name and a message on the standard error stream in an unspecified format, and abort program execution via the abort() function. For example:

a.c:10: foobar: Assertion a == b failed.

If function is NULL, __assert_fail() shall omit information about the function.

assertion, file, and line shall be non-NULL.

The __assert_fail() function is not in the source standard; it is only in the binary standard. The assert() interface is not in the binary standard; it is only in the source standard. The assert() may be implemented as a macro.