title: arithmetic exception in C#
body: <p>Why in C# is Example A valid, compilable and will just wrap while examples B will not compile?</p>
  
  <p>A</p>
  
  <pre><code>int val = 0;
  val = val + Int32.MaxValue +2;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>int val = Int32.MaxValue;
  val++;
  </code></pre>
  
  <p>B</p>
  
  <pre><code>int val = 0;
  val = 2147483647 + 1;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>int val = 0;
  int val = Int32.MaxValue + 1;
  </code></pre>
  
  <p>I know by default that arithmetic exceptions are not checked by default unless you explicitly do so using checked method, block or attribute in the config. My question relates more to compiler then how an arithmetic exception happens.</p>