2 ms·
x86 processors already have overflow and carry bits in their flags register to tell when overflow has occurred. It makes more sense to me to have compiler writ
by jlarocco 12y ago
x86 processors already have overflow and carry bits in their flags register to tell when overflow has occurred.
It makes more sense to me to have compiler writers check the flags if they care about overflow, and avoid the slow down if they don't.
- danbruc 12y agoNo, doing it in hardware makes more sense. If you expect overflows you disable overflow checks in the hardware and everything is as before. If you don't expect overflows you enable overflow checks in the hardware and if you have a bug you get the exception. If you do it in software you have to execute additional instruction every time but they will do nothing useful if your program is correct.