Re:“Rust is safe” is not some kind of absolute guarantee of ...
by zozbot234 on Sunday October 02, 2022 @12:58PM
(#33057778)
The problem with #3 is not really about C vs. Rust, it's about modern optimizing compilers (including GCC). A compiler is allowed to assume that UB simply won't happen, so it makes no guarantees whatsoever about what happens if UB is ever hit. It's not "return a random value", it really is "all bets are off". There is no guarantee that you manage to "limp along" in any reasonable sense, let alone report the failure. That's what "panic and recover" mechanisms are for, and yes even the ? operator in Rust can be seen as such a mechanism.
[ Parent
| on HN ]
There are no comments on this comment yet.