title: Why will c++ assert() function brings overhead to program
body: <p>I have the practice to use c++ assert to check if the program is running normally, such as this:</p>
  <pre><code>cv::Mat im = imread(&quot;pic.jpg&quot;)
  assert(!im);
  </code></pre>
  <p>This would check if the image is read correctly. This is useful since the image might not be correctly placed in the expected directory, so we need to check. I feel that using <code>assert</code> is convenient, but people say that using <code>assert</code> would bring overhead to the program, and the suggestion is not using them. Why <code>assert</code> will bring overhead ? What is the good practice to check in this case ?</p>