3 ms·
Undefined behaviour can be tricky, but I don't think it is THAT tricky. If a check for a divisor of zero done before a division could be eliminated, programmin
by radford-neal 9y ago
Undefined behaviour can be tricky, but I don't think it is THAT tricky. If a check for a divisor of zero done before a division could be eliminated, programming would become completely impossible.
On the other hand, code that does the division first, and AFTER that checks whether the divisor was zero, could fall prey to the dreaded undefined behaviour optimization...