4 ms·
The difference is that the C++ spec is ~1700+ pages of very dense and oftentimes subtle language that no one fully understands. Moreover, even the committee can
by AlotOfReading 5y ago
The difference is that the C++ spec is ~1700+ pages of very dense and oftentimes subtle language that no one fully understands. Moreover, even the committee can't tell you all the UB that exists. There's a proposal to simply enumerate the explicit UB [1] they do know about, but even that doesn't exist yet.
When the situation with the language is such that no human or program yet invented can confidently assert the defined-ness of any particular bit of code, it's 100% the language's fault. Who else could be at fault for it being impossible to write safely?
An amusing anecdote is that there's a conference for UB detectors called sv-comp. They have a suite of example programs with completely defined behavior that are used to detect false-positives. People keep finding UB in the C examples [2].
[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1705r1.html http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p170...
[2] https://runtimeverification.com/blog/mare-than-14-of-sv-comps-correct-programs-are-undefined https://runtimeverification.com/blog/mare-than-14-of-sv-comp...