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

According to the C++11 standard, the compiler may assume that any loop terminates, so unless you mark ring_bell as [[noreturn]], the code will be assumed reachable.

Furthermore, when undefined behaviour is invoked anywhere within a program, the whole program is undefined.



As far as I remember, you are wrong: a loop with side effects (either external IO or volatile reads/writes) is allowed to never terminate.




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

Search: