Why in C# is Example A valid, compilable and will just wrap while examples B will not compile?
A
int val = 0;
val = val + Int32.MaxValue +2;
or
int val = Int32.MaxValue;
val++;
B
int val = 0;
val = 2147483647 + 1;
or
int val = 0;
int val = Int32.MaxValue + 1;
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.