Re:UndefinedBehaviorSanitizer's Unexpected Behavior
by umanwizard on Thursday October 17, 2024 @07:51AM
(#41868750)
C++ is further than rust in my opinion. Vtables that support inheritance, as well as stack unwinding for exceptions, are pretty complicated and totally implicit in C++. Okay rust also technically has unwinding for panics to be fair but it’s rather unusual in practice for programmers to use panics to mean anything other than “crash the program now”.
[ Parent
| on HN ]
Re:UndefinedBehaviorSanitizer's Unexpected Behavior
by pjmlp on Thursday October 17, 2024 @08:08AM
(#41868868)
Like trait implementations, and trait objects.
Re:UndefinedBehaviorSanitizer's Unexpected Behavior
by umanwizard on Thursday October 17, 2024 @09:26AM
(#41869462)
That’s fair, trait objects do cause a table to be generated, but they don’t support inheritance and subjectively I think they’re used less often than the OOP features of c++ that lead to vtable-based dynamic dispatch. (Traits are extremely common in rust, but dyn trait objects somewhat less so)
Re:UndefinedBehaviorSanitizer's Unexpected Behavior
by pjmlp on Thursday October 17, 2024 @09:48AM
(#41869646)
Doesn't matter how common, the feature is there, and although we aren't yet that far, might even differ across implementations.
Also trait inheritance exists, enforced via trait bounds, what Rust doesn't support is class inheritance.
Re:UndefinedBehaviorSanitizer's Unexpected Behavior
by umanwizard on Thursday October 17, 2024 @10:09AM
(#41869845)
> Doesn't matter how common
Yes it does, if your concern is “how often do I encounter code where I can’t predict or control what it actually does on the hardware”.