Comment by smarks
All this is true. Note also that the C++ folks are putting a serious effort into reducing UB. See the "safe by default" section of this writeup [1]. See also my other comment [2] regarding the performance impact of this sort of change. Short answer: with sufficient optimization, smaller than one might think.
[1]: https://herbsutter.com/2024/08/07/reader-qa-what-does-it-mea...