Re:Tell HN: C Experts Panel – Ask us anything about C
by userbinator on Tuesday April 14, 2020 @08:07PM
(#22872971)
I've always thought that assuming such things should be wrong, because if you were writing the Asm manually, you would certainly think about it and NOT optimise unless you had a very good reason why it won't overflow. Likewise, I think that unless the compiler can prove that it, it should, like the sane human, refrain from making the assumption.
[ Parent
| on HN ]
Re:Tell HN: C Experts Panel – Ask us anything about C
by scaredginger on Tuesday April 14, 2020 @08:38PM
(#22873151)
Well, by that reasoning, if you were coding in C, you would certainly think about it and ensure overflows won't happen.
The fact is that if the compiler encounters undefined behaviour, it can do basically whatever it wants and it will still be standard-compliant.