T
Tony Johansson
Hello Experts!
I'm reading a book called programming with design pattern revealed
by Tomasz Muldner and here I read something that I don' work.
The text in the book says
"To offer the programmer the choice of toggling between using and not using
asser(), this function
is used together with a macro called NDEBUG; when this macro is defined,
assert() does nothing. If NDEBUG is not defined and the actual parameter of
assert() evalutates to 0, then the name of the source file and the number of
the line on which assert() appears is displayed, and the execution of the
program is aborted by calling abort()"
If I want to use this macro I have to define it in this way
#define NDEBUG
asser(expression);
#endif
So if you want to use this NDEBUG macro I have to manually define or
undefine it.
So what the text say must be completely wrong.
//Tony
I'm reading a book called programming with design pattern revealed
by Tomasz Muldner and here I read something that I don' work.
The text in the book says
"To offer the programmer the choice of toggling between using and not using
asser(), this function
is used together with a macro called NDEBUG; when this macro is defined,
assert() does nothing. If NDEBUG is not defined and the actual parameter of
assert() evalutates to 0, then the name of the source file and the number of
the line on which assert() appears is displayed, and the execution of the
program is aborted by calling abort()"
If I want to use this macro I have to define it in this way
#define NDEBUG
asser(expression);
#endif
So if you want to use this NDEBUG macro I have to manually define or
undefine it.
So what the text say must be completely wrong.
//Tony