4 ms·
Checking for signed overflow by first performing signed overflow is a great C antipattern.
by cwzwarich 14y ago
Checking for signed overflow by first performing signed overflow is a great C antipattern.
- regehr 14y agoExactly. I've seen plenty of overflow detection libraries that do precisely this. The undefined overflow plus the lack of access to CPU flags makes a pretty good argument against doing this stuff at the C/C++ level.