<p><pre><code> Normally, asserts are only compiled into debug versions
of the code, and removed for release versions.
</code></pre>
I know a lot of languages default to this, and it always seemed like a bad decision to me. The performance benefits of most checks are trivial compared to the major downside of not testing the exact code you release.<p>Several times I've had to track down bugs that have been very difficult to find, as they were 'fixed' by side effects of assert statements and hence didn't show up in debug builds.<p>If a check really can't be performed in the release version for performance reasons, just separate it out into a unit test.
<i>This use of assert is silly. The code should look like this:</i><p>In examples 2, 3 and 4 the author explains what's wrong with the code and why it's a bad use of assert(). In example 1 though it's just called silly. What's wrong with that one?
The nuance of calling people names is lost on the author. Bad code can be written by great coders. It happens to the best of us. No need to insult people to improve code.