C++26 gets contracts. The man who built them into D says they weren't useful (cppstories.com)
Contracts let a C++ function state what callers must guarantee and what it promises back. A violation can be ignored, observed, enforced or quick-enforced, chosen per build with no portable per-assertion switch, and the guide warns they are not input validation.
Walter Bright, who says he added contracts to Zortech C++ in the 1990s and to D later, wrote that they "just turned out to not be very useful". An embedded developer wants the opposite trade: checks on at the workstation, off on weak production CPUs.
Sign in to save