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

Are there any languages other than C and C++ that have this “nasal demons” interpretation of undefined behavior?


I assume this is a product of sufficiently advanced compilers. Other LLVM languages almost certainly suffer from this too, including Zig, Swift and unsafe rust.


Are you asking if there are programming languages in which how undefined behaviour behaves is strictly defined?


I’m talking about the “non-local” flavor of undefined behavior. For example, I’d expect the following code:

  int x;
  printf("%d", x - x);
to always print 0, but it can it fact do anything at all.


I think so, at least when it comes to assuming that multi-threading data races don't happen.


Rust and Zig do, and I think also Go.




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

Search: