Take a look at this code:
#include <cassert>
#ifdef DEBUG
#define ASSERT(expr) assert(expr)
#else
#define ASSERT(expr)
#endif /* DEBUG */
The program will run only if I have DEBUG defined, otherwise it will hang and terminate with no results. I am using MinGW in Eclipse Indigo CDT. Advice is appreciated!
You are almost certainly abusing assertions. An assertion expression must never have side effects.
When you say,
assert(initialize_critical_space_technology());, and then you omit this entire line in the release build, you can imagine for yourself what will happen.The only safe and sane way to use assertions is on values:
Some people introduce a
VERIFYmacro for something that always executes the code: