3 ms·
Pretty hard. C is a minefield of undefined behavior. Integer overflow is considered undefined behavior. Which means its perfectly valid to call abort(), wipe
by sbov 16y ago
Pretty hard. C is a minefield of undefined behavior. Integer overflow is considered undefined behavior. Which means its perfectly valid to call abort(), wipe your hard drive, then light your system on fire. Or, have the number quietly wrap around.
Oh, and its perfectly fine for me to change the behavior from one to the other, or even have a lookup table of random responses to undefined behavior. Because, like, you're not following the standard. And its so easy.
- jpr 16y agoFor what it's worth, I agree. Every time I hear about problems that arise from programming in C, with its undefined behaviour etc., I think to myself, there must be a better way to do it. But I don't know of any way that wouldn't involve scrapping 90%+ of software we use every day.
- haberman 16y ago> C is a minefield of undefined behavior. Integer overflow is considered undefined behavior. Only for signed integers. Unsigned integers are defined to wrap around.
- yuhong 16y agoYea, I remember the joke about gcc #pragma once causing something like rogue to run.