3 ms·
The term is "library UB" versus "language UB". To be clear, you should still avoid it most of the times.
by afdbcreid 3y ago
The term is "library UB" versus "language UB". To be clear, you should still avoid it most of the times.
- steveklabnik 3y agoAh yes, thank you.
- _nalply 3y agoWould you say library undefined behavior is just a violation of a library invariant? Like `&str` and `String` containing valid UTF-8? I admit that a library invariant is allowed to be violated temporarily under some strict preconditions. One example are bank account money transfers, where the credit and debit don't happen exactly simultaneously. Something similar could happen in a library. But for language UB this doesn't work. Why? Is it because of compile-time optimizations possibly deleting code restoring the invariant?