add directory Ref-docs
This commit is contained in:
98
Ref-docs/c_lib_guide/2.1.html
Normal file
98
Ref-docs/c_lib_guide/2.1.html
Normal file
@@ -0,0 +1,98 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
C Guide--2.1 assert.h
|
||||
</title>
|
||||
<!-- Changed by: eric huss, 12-Mar-1997 -->
|
||||
</head>
|
||||
<body text="#000000" bgcolor="#FFFFFF">
|
||||
|
||||
<center>
|
||||
<table border=0 width=100%>
|
||||
<tr>
|
||||
<td align=left width=20% valign=top>
|
||||
<a href="1.7.html">
|
||||
<img src="left.gif" border=0>
|
||||
Previous Section<br>
|
||||
1.7 Preprocessing Directives</a></td>
|
||||
<td align=center width=60% valign=top>
|
||||
| <a href="index.html">Table of Contents</a> |
|
||||
<a href="index2.html">Index</a> |</td>
|
||||
<td align=right width=20% valign=top>
|
||||
<a href="2.2.html">
|
||||
Next Section
|
||||
<img src="right.gif" border=0><br>
|
||||
2.2 ctype.h</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<hr>
|
||||
|
||||
<h1>2.1 assert.h</h1>
|
||||
<p>
|
||||
The assert header is used for debugging purposes.
|
||||
<p>
|
||||
Macros:
|
||||
<blockquote><code><b>
|
||||
assert();
|
||||
</b></code></blockquote>
|
||||
External References:
|
||||
<blockquote><code><b>
|
||||
NDEBUG
|
||||
</b></code></blockquote>
|
||||
<a name="assert"></a>
|
||||
<h2>2.1.1 assert</h2>
|
||||
<p>
|
||||
Declaration:
|
||||
<blockquote><code><b>
|
||||
void assert(int </b></code><i>expression</i><code><b>);</b></code>
|
||||
</blockquote>
|
||||
The assert macro allows diagnostic information to be written to the standard error file.
|
||||
<p>
|
||||
If expression evaluates to 0 (false), then the expression, sourcecode filename, and line
|
||||
number are sent to the standard error, and then calls the abort function. If the identifier
|
||||
<code><b>NDEBUG</b></code> ("no debug") is defined with <code><b>#define NDEBUG</b></code> then the macro assert does nothing.
|
||||
<p>
|
||||
Common error outputting is in the form:
|
||||
<blockquote><code><b>
|
||||
Assertion failed:</code></b><i> expression</i><code><b>, file</b></code> <i>filename</i><code><b>, line</b></code><i> line-number</i>
|
||||
</blockquote>
|
||||
Example:
|
||||
<blockquote><code><b><pre>
|
||||
#include<assert.h>
|
||||
|
||||
void open_record(char *record_name)
|
||||
{
|
||||
assert(record_name!=NULL);
|
||||
/* Rest of code */
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
open_record(NULL);
|
||||
}
|
||||
|
||||
</pre></b></code></blockquote>
|
||||
<hr>
|
||||
<center>
|
||||
<table border=0 width=100%>
|
||||
<tr>
|
||||
<td align=left width=20% valign=top>
|
||||
<a href="1.7.html">
|
||||
<img src="left.gif" border=0>
|
||||
Previous Section<br>
|
||||
1.7 Preprocessing Directives</a></td>
|
||||
<td align=center width=60% valign=top>
|
||||
| <a href="index.html">Table of Contents</a> |
|
||||
<a href="index2.html">Index</a> |</td>
|
||||
<td align=right width=20% valign=top>
|
||||
<a href="2.2.html">
|
||||
Next Section
|
||||
<img src="right.gif" border=0><br>
|
||||
2.2 ctype.h</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user