4 ms·
No. It can check whether the operands will cause overflow and issue an error instead of silently giving a bogus result. It's a performance hit though. I don't
by luk32 8y ago
No. It can check whether the operands will cause overflow and issue an error instead of silently giving a bogus result.
It's a performance hit though.
I don't think you'd want a banking app written with assumption that you'll never have more than MAXINT amount of dollars, and adding few more will roll you back to 0 or even put you in debt... silently... because well it works this way, and designer didint think you'll hit the limit. If it ever happened you'd like a siren to go off.
- saagarjha 8y ago> It can check whether the operands will cause overflow and issue an error instead of silently giving a bogus result. Yes, and it could also decide to wipe your hard drive because of the latitude given to it by the C standard. Many compilers have an option to enable some sort of special behavior when a signed integer overflows, but such extensions are non-standard.