1.1 Assert.h
The assertion header file is used for debugging.
Macro:
ASSERT ();
External references:
Ndebug
1.1. Assert
Statement:
void assert (intexpression);
A macro in the assertion header file allows you to write some special information to a standard error file.
If the expression has a value of 0 (false), then the expression, the source file name, and the line number are sent to the standard error output and the Abort function is invoked. If the identifier Ndebug ("No Debug") is defined by #define NDEBUG, the macro in the assertion header file does nothing.
The standard error output is formatted as follows:
Assertion Failed:expression, Filefilename, line Line-number
Instance:
#include <assert.h>
void Open_record (char *record_name)
{
assert (record_name!=null);
/* Rest of code
*
/} int main (void)
{
Open_record (NULL);
}
Original English: http://www.acm.uiuc.edu/webmonkeys/book/c_guide/2.1.html
Original Author: Eric Huss
Chinese translator: Liu Yong poechant
Copyright: The original copy of this article is owned by Eric Huss, and the Chinese translation is poechant All rights reserved. Reprint please specify from "Liuda csdn blog": http://blog.csdn.net/poechant