previous | start | next

Overflow?

This program compiles and runs with no errors reported even though the 0 result is clearly wrong mathematically.

This just emphasizes the fact that arithmetic for these integer data types does not obey the same rules as ordinary integer arithmetic.

How does a programmer write code to check whether overflow may occur for these data types?



previous | start | next