Re:How expensive is integer-overflow trapping in C++?
by MaxBarraclough on Friday September 25, 2020 @04:52AM
(#24587919)
This thread is about C++.
Re:How expensive is integer-overflow trapping in C++?
by masklinn on Friday September 25, 2020 @11:23AM
(#24590775)
This sub-thread's starting point was literally a comment on Swift's behaviour. Unless C++ has drastically changed and now abruptly aborts on overflow.
Re:How expensive is integer-overflow trapping in C++?
by MaxBarraclough on Friday September 25, 2020 @11:35AM
(#24590903)
I think you have this confused with the subthread under alblue's comment.
Overflow is neither wrapping nor UB in Swift, it’s an error. Overflow is never UB in Rust but it might be wrapping or a panic. Overflow doesn’t exist in Python or Erlang. I think overflow is IB in Haskell.
You get the point: that signed overflow is UB and unsigned wraps in C has no bearing on what other langages do.
Swift traps on overflow, regardless of signedness.