C and C++ prioritize performance over correctness
&gt;For example, a common thing programmers expect is that you can test for signed integer overflow by checking whether the result is less than one of the operands, as in this program:<p><pre><code>    #include &lt;stdio.h&gt;

    int f(int x) {
        if(x+100 &lt; x)
            printf(&quot;overflow\n&quot;);
        return x+100;
    }
</code></pre>
&gt;Clang optimizes away the if statement. The justification is that since signed integer overflow is undefined behavior, the compiler can assume it never happens, so x+100 must never be less than x. Ironically, this program would correctly detect overflow on both ones&#x27;-complement and two&#x27;s-complement machines if the compiler would actually emit the check.<p>My god…