GotW #97 Solution: Assertions (Difficulty: 4/10)
Sutter's Mill
JANUARY 11, 2021
And asserted conditions only evaluated if they’re enabled, so any side effects won’t happen when they’re not enabled; they might sometimes perform local side effects, such as to do logging or allocate memory, but the program should never rely on them happening or not happening. Assertions are only about finding bugs, not doing program work.
Let's personalize your content