Ok, in that case thank you for the correction, it helps to place Rust a little bit more accurate on my mental map of programming languages.
Btw, and on the same note, I always felt that it should be possible to generate a fault on an unexpected carry so I see this as much as a CPU issue as a programming language issue.
Re:Rust things I miss in C
by steveklabnik on Monday February 19, 2018 @11:25AM
(#16413764)
No worries! That discrepancy might explain why we've occasionally butted heads in the past with regards to the language :)
Yes. That still requires unsafe code. All bets are off there. You should be validating everything with regards to unsafe. There's tons of ways unsafe can go wrong; this scenario is a drop in the bucket. The bug is fundamentally in that unsafe code, not in the overflowed integer, as unsafe code is not supposed to expose memory unsafety; you could have passed a zero or a -128 or whatever manually, and it would still have caused this.
> The very best spot to trap an error is where it is first initiated,
I agree completely!
> I thought - perhaps mistakenly so - the Rust crowd was trying to address.
If you believed that Rust was about program correctness above all else, then yes, you were mistaken. As I said above, our priorities are memory safety above all else. Correctness is certainly up there, but when the rubber hits the road, hard choices have to be made.