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

It can't be a compile error. It's not an error for a program to contain such code, it's only an error if that code executes.


That's not strictly true. Undefined behavior includes unsuccessful compilation as well [0]. But for this the compiler has to prove that the offending code is executed every time the program is executed. I think compilers don't bother with this though.

[0] https://eel.is/c++draft/intro.defs#defns.undefined-sentence-...




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

Search: