However, we can always do better - when using #ifdef, specify your intent. The fact that a directive happens to be turned on only in debug mode, that's a different story.
Why? You have more flexibility, being able to turn the directive on/off in both debug and release configurations, or even in other custom configuration you might have.
Case in point:
// even on a failed assertion, we don't break!
#define assert(exp) (void)( (exp) || (custom_assert(#exp, __FILE__, __LINE__), 0) )
void custom_assert(const char *, const char *, unsigned);
The above allows me to create my custom assert function. This will happen only if CUSTOM_ASSERT is turned on.
For my application , I need this:
- in release, while doing testing
- in debug mode, while deploying application to the customer