3 ms·
Oh, more than is ready for UB, that's a certainty. But yeah, the normal way to handle an overflow should be an error. Most languages disagree, but I do think n
by marcosdumay 4y ago
Oh, more than is ready for UB, that's a certainty.
But yeah, the normal way to handle an overflow should be an error. Most languages disagree, but I do think nearly every language is wrong here.
- vbezhenar 4y agoIs it possible to configure CPU to interrupt on overflow? Otherwise cost will be too high.
- jart 4y agoYou use -ftrapv, which uses the CPU accelerated overflow detection.
- marcosdumay 4y agoWe are in a loop where CPU designers don't create good portable ways to detect overflow, because languages won't use them; and languages do not detect overflow because CPUs don't have a good portable way of doing it. On AMD64 you can at least avoid check after each single instruction. So it becomes less expensive.
- zajio1am 4y ago> On AMD64 you can at least avoid check after each single instruction. So it becomes less expensive. How?