3 ms·
>signed integer overflow being UB would count for C/C++ Then, I raise you to Zig which has unsigned integer overflow being UB.
by renox 9mo ago
>signed integer overflow being UB would count for C/C++
Then, I raise you to Zig which has unsigned integer overflow being UB.
- steveklabnik 9mo agoInterestingly enough, Zig does not use the same terminology as C/C++/Rust do here. Zig has "illegal behavior," which is either "safety checked" or "unchecked." Unchecked illegal behavior is like undefined behavior. Compiler flags and in-source annotations can change the semantics from checked to unchecked or vice versa. Anyway that's a long way of saying that you're right, integer overflow is illegal behavior, I just think it's interesting.
- ladyanita22 9mo agoRust has UB overflow as well, just unsafe. https://doc.rust-lang.org/std/intrinsics/fn.unchecked_add.html https://doc.rust-lang.org/std/intrinsics/fn.unchecked_add.ht...