G
Guest
how come when i add two Int32 vars in a try catch statement with the value
of 2147483647 it results in -2 instead of an exception?
of 2147483647 it results in -2 instead of an exception?
Jack said:how come when i add two Int32 vars in a try catch statement with the value
of 2147483647 it results in -2 instead of an exception?
Julie said:1) 2147483647 + 2147483647 stored in a signed 32-bit location overflows
the positive range, and results in a wrapped value which is -2 in this
case. Research integer overflow for more & complete details.
2) Integer overflow doesn't cause an exception.