[libcxx-commits] [libcxx] [libc++][hardening] Categorize more assertions. (PR #75918)

Konstantin Varlamov via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 4 18:56:40 PST 2024


var-const wrote:

> [...] How often do they fire?

@EricWF Unfortunately, I don't think we really have the data to answer that. I'm not aware of any bug reports (@ldionne Louis, do you know of any?), but I think we've seen cases when even pretty significant bugs were not reported for a long time despite people hitting them, so I don't think we can be confident these are _never_ triggered just because we don't hear from users. Intuitively though, it does seem like it should be rare.

I'm personally somewhat in favor of keeping them (or at least most of them), not so much for actually catching bugs in the wild (although if that happens, it's awesome) but more as a useful form of documentation and an aid in refactoring. I think there is some value in a function stating its invariants and preconditions explicitly in the form of assertions, and I definitely hit some internal assertions when doing `ranges::to`-related changes in containers which likely saved me some time on debugging.



https://github.com/llvm/llvm-project/pull/75918


More information about the libcxx-commits mailing list