Hacker News new | past | comments | ask | show | jobs | submit login

The problem is that this doesn't mean anything, at least in terms of the C programming language. You say "When integers overflow, they do that and nothing else," but there is no definition of signed integer overflow, so there is no "that" for them to do. That is what it means for something to be undefined behavior. You have some definition in your mind, which might happen to match what some versions of some compilers do at some optimization levels — but that isn't actually the definition, because there isn't one.



Wrapping arithmetic is supported by gcc and clang.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: