2 comments

[ 1.7 ms ] story [ 13.8 ms ] thread
This paper is a core part and fundamental research evolving into how C++ could eliminate UB from the language in the future via a hybrid approach: subsetting, runtime checks, annotations, new features.

I think it is worth a look.

Original title is "A framework for systematically addressing undefined behaviour in the C++ Standard". The HN title is misleading in two ways:

- The paper covers more than just implicit contract assertions

- Implicit contract assertions are stated to cover only a (large) subset of UB in C++. Other techniques are needed to address UB that falls outside this subset. From the paper (italics in original):

> In this section, we propose a framework that systematically introduces runtime checks and well-defined replacement behaviour — two of the tools that form the strategy presented in Section 3 — to the C++ Standard. Runtime checks guarding against core language UB are realised as implicit contract assertions

And later:

> Having specified precisely what an implicit contract assertion is and how it behaves, we can now apply that specification to every case of UB that is — at least in principle — checkable at run time. As we saw in Section 2, this is true for 77 cases, that is, 95% of all identified cases of explicit core language UB in C++.