top | item 47193645

(no title)

xigoi | 3 days ago

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

discuss

order

josephg|3 days ago

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.

bregma|3 days ago

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

xigoi|2 days ago

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.

FartyMcFarter|3 days ago

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

IshKebab|3 days ago

Rust and Zig do, and I think also Go.