|
|
|
|
|
by nicoburns
2230 days ago
|
|
> A huge fraction of the time you'll just step out of the bounds of an array, just deterministically instead of nondeterministically. Well arrays are bounds checked by default in Rust, so you can't do that one. You're more likely to hit a crash, which I think is decidedly better than the compiler deciding to optimise out or rewrite your function because it contained UB. |
|
But that's my entire point. If you're observing a benefit here, it's decidedly not due to the wrap-around, but due to other features (like bounds checking), and the argument should be that those features make Rust better than C++. It seems strange to give praise to the multiplication wrap-around instead.