Question 8
Back to Exercise
What happens to assert(x > 0) if NDEBUG is defined before including <assert.h>?
- A It always aborts
- B It expands to nothing – the expression is not evaluated at all Correct
- C It prints a warning and continues
- D It becomes a static_assert
Correct Answer: Option B
Release builds commonly define NDEBUG. That is why asserts must not contain side effects and must not replace real input validation.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!