Support for contract based programming in C++ was adopted ino the C++20 working draft in Rapperswil. One part of this language feature is this notion of a violation handler which will be invoked when a contract is violated.
Herb Sutter's trip report states that:
You get to install your own violation handler and ship a release build with the option of turning on enforcement at run time.
But the wording in [dcl.attr.contract] that this paper added says:
The violation handler of a program is a function of type “
noexcept
opt function of (lvalue reference toconst std::contract_violation
) returningvoid
”, and is specified in an implementation-defined manner. [...] There should be no programmatic way of setting or modifying the violation handler. It is implementation-defined how the violation handler is established for a program and how thestd::contract_violation
([support.contract.cviol]) argument value is set, except as specified below.
This is very unclear to me. How might an implementation allow me to set my own violation handler, in a non-programmatic way? What will I have to do on gcc, clang, and msvc?