Commit | Line | Data |
---|---|---|
6022f826 TL |
1 | .TH ASSERT 3X |
2 | .SH NAME | |
3 | assert \- program verification | |
4 | .SH SYNOPSIS | |
5 | .B #include <assert.h> | |
6 | .PP | |
7 | .B assert (expression) | |
8 | .SH DESCRIPTION | |
9 | .PP | |
10 | .I Assert | |
11 | is a macro that indicates | |
12 | .I expression | |
13 | is expected to be true at this point in the program. | |
14 | It causes an | |
15 | .IR exit (2) | |
16 | with a diagnostic comment on the standard output | |
17 | when | |
18 | .I expression | |
19 | is false (0). | |
20 | Compiling with the | |
21 | .IR cc (1) | |
22 | option | |
23 | .SM | |
24 | .B \-DNDEBUG | |
25 | effectively deletes | |
26 | .I assert | |
27 | from the program. | |
28 | .SH DIAGNOSTICS | |
29 | `Assertion failed: file | |
30 | .I f | |
31 | line | |
32 | .I n.' | |
33 | .I F | |
34 | is the source file and | |
35 | .I n | |
36 | the source line number | |
37 | of the | |
38 | .I assert | |
39 | statement. |