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

> If the invalid arithmetic proceeds without crashing, and produces a value in the int32_t i variable, then that issue is settled. The subsequent statement should behave according to accessing that value.

The C standard imposes no such constraint on undefined behaviour, neither is it the case that real compilers always behave as if it did.

hxhxhrra has already shown this, but here's another good blog post on this kind of thing: https://markshroyer.com/2012/06/c-both-true-and-false/



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

Search: