Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 112 -
Function Reference
~~~~~~~~~~~~~~~~~~
Refer ANSI C language regulation for detail function specifications.
1. Diagnostics ( assert.h )
-----------------------------------------------------------------------
1.1 Abort by assertion
. <Main>
-----------------------------------------------------------------------
[Name]
assert
[Syntax]
#include <assert.h>
void assert( int expression ) ;
[Arguments]
expression Expression to be diagnosed.
[Return]
------
[Description]
"assert" is used to debug programs simply. "assert" displays
diagnostic message and stops the program when the value of
"expression" is false (i.e. "0"). To stop the program,
"while(1);"
is execute, the next step is never executed. When "expression" is
true (i.e. non-zero), "assert" does nothing.
"assert" is defined as MACRO, so, define NDEBUG identifier and
recompile to remove it.
The diagnostic message is displayed with the following format.
"Assertion failed : expression [expression] in file [filename]
at line linenum"
Only programmer can understand this diagnostic message. It is
recommended to do user's own error checking and to display error
messages for easy application maintenance.