|
|
|
|
|
by mgaunard
813 days ago
|
|
The main iteration this cycle for the next C++ is contracts. Contracts are all about introducing undefined behaviour if you don't satisfy a precondition. In practice this improves software quality on many levels by clearly defining requirements on interface boundaries that would otherwise be implicit or just documented. Of course you can have special debug modes where you actually check that contracts are being satisfied. |
|
As ever the C++ train leaves on schedule with or without anything you suppose is "promised" for that standard revision. This has been the practice since 2011 and I don't expect it to stop unless ISO tells them "Enough" or the whole thing comes apart.
> Contracts are all about introducing undefined behaviour if you don't satisfy a precondition.
Nope. That's explicitly not what the proposal sets out to do. It is likely that, as usual, WG21 will manage to take facilities intended to be safe, file them to a sharp edge and then slit their own throats, but P2900 in its current form doesn't do so. Here's an item from the proposal's list of things they're explicitly not proposing:
"The ability to assume that an unchecked contract predicate would evaluate to true, and allow the compiler to optimize based on that assumption, i.e. the assume semantic"
One of the three significant implementers, Microsoft, actually strongly objects to any idea of introducing yet more Undefined Behaviour into a language that is distinctly underwater when it comes to provable correctness. Microsoft shut down previous proposals in this area, and while they might (wrongly IMO) be sold the compromise position that's advocated by some WG21 members today (some UB in some contract checks), you're asking for a lot more.