Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> For signed integer addition the compiler is allowed to assume that `(num < (num + 1))` is true, so the comparison can be removed entirely.

That's not directly what the compiler assumes. The direct problem is in 'a + 1' having undefined behaviour, and that transitively allows the assumption on the comparison that you mentioned.

This was an example where 'a + 1' doesn't compile to an add instruction.



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

Search: