4.2. Assert_return() Macro
Assert_return() macro evaluates the
argument expression and if it is false, an error message with file
name and line number is logged to the application log file,
and program control is returned back from current execution scope
with FALSE value.
#define Assert_return (a)
|
For example, member function initialize()
of class IO_Handler either proceeds its
code execution or returns false,
depending on the return value of a call to
loadConfig():
213: bool
214: IO_Handler::initialize (IO_Server* svr_)
215: {
216: Assert_return (loadConfig ());
217:
218: // proceed with initialization ...
219:
220: return (true);
221: }
|
In case if load_config() fails, the warning
message is written to the log file:
Assert Returned False Expression!
Error on line 216 in file IO_Handler.cpp
|
| The calling function is assumed to have a return value of either
bool or
int.
|