title: What is the strategy if assertion fails
body: <p>Assertion is used to check whether a condition is met(precondition, postcondition, invariants) and help programmers find holes during debugging phase.</p>
  
  <p>For example,</p>
  
  <pre><code>void f(int *p)
  {
    assert(p);
    p-&gt;do();
  }
  </code></pre>
  
  <p>My question is do we need to assume the condition could not be met in release mode and handle the case accordingly?</p>
  
  <pre><code>void f(int *p)
  {
    assert(p);
  
    if (p)
    {
      p-&gt;do();
    }
  }
  </code></pre>
  
  <p>After all, assertion means that the condition it tests should NEVER be false. But if, if we don't check it and it fails, program crashes. Sounds like a dilemma. How do you guys deal with it?</p>