title: C# - What could cause overflow checking here?
body: <p>I am accustomed to C# not performing overflow checks, as the language spec states (§7.5.12):</p>
  
  <blockquote>
    <p>For non-constant expressions (expressions that are evaluated at run-time) that are not enclosed by any checked or unchecked operators or statements, the default overflow checking context is unchecked unless external factors (such as compiler switches and execution environment configuration) call for checked evaluation.</p>
  </blockquote>
  
  <p>I took advantage of this when doing an array bounds check in low-level code:</p>
  
  <pre><code>if ((uint)index &gt;= (uint)TotalCount)
      ...
  </code></pre>
  
  <p>If index is negative, I expect it to become a large positive number so that it exceeds TotalCount. However, to my surprise, a negative number produces OverflowException, and I have to wrap the expression in unchecked(). I looked through the project options in Visual Studio and I do not see an option to enable or disable overflow checking. So why might it be on here?</p>