3 ms·
The value of undefined behavior
- deleted 8y ago[deleted]
- andreareina 8y agoThe trouble is checking for undefined behavior (is adding these two ints going to result in overflow?) without triggering said undefined behavior. Ideally the checks would either be available as a function defined by the spec so that the compilers can do the right thing depending on the architecture. Failing that the compilers would have to pattern-match common idioms like they do for other situations like exchanging two variables, rotating shifts, etc.