That can&#x27;t prevent every logic error. Here&#x27;s[0] something I remember reading that really impressed me with static analysis tools. Running PVS-Studio against the Unreal 4 Engine (which is entirely C++).<p>It was able to detect a surprising number of logic errors, probably just caused by as tired programmer, or copy-pasting too quickly. For example in the function below, it was able to spot that the last 2 clauses of that comparison are identical. The programmer meant to use a &#x27;+&#x27; instead of &#x27;-&#x27; in the last one. I don&#x27;t think you could have a type system that would disallow this logic error. (If it is possible, please prove me wrong, because that sounds awesome).<p><pre><code>  static bool PositionIsInside(....)
  {
    return
      Position.X &gt;= Control.Center.X - BoxSize.X * 0.5f &amp;&amp;
      Position.X &lt;= Control.Center.X + BoxSize.X * 0.5f &amp;&amp;
      Position.Y &gt;= Control.Center.Y - BoxSize.Y * 0.5f &amp;&amp;
      Position.Y &gt;= Control.Center.Y - BoxSize.Y * 0.5f;
  }
</code></pre>
[0] <a href="http:&#x2F;&#x2F;www.viva64.com&#x2F;en&#x2F;b&#x2F;0249&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.viva64.com&#x2F;en&#x2F;b&#x2F;0249&#x2F;</a>