Re:C++26 Disapproved
by hankbond on Tuesday November 03, 2026 @10:16PM
(#50361140)
Maybe my reading comprehension has just nosedived but I could not find where this article discusses what the heck Contracts refers to?
[ Parent
| on HN ]
Re:C++26 Disapproved
by AlotOfReading on Tuesday November 03, 2026 @10:19PM
(#50361151)
You'll find plenty of info if you search for anything like "c++ contracts" [0], but the short of it is that they're just pre/post conditions on functions. Slightly improved assertions, basically.
https://www.cppstories.com/2026/cpp26_contracts/ is IMO a better introduction.
cppreference is often a bit too technical for its own good :)
But I think there's a broader issue which is that if it took me multiple searches to find a good-enough visual "pitch" for what contracts look like in practice, its champions have not yet won hearts and minds - which brings us to the situation at hand.
Re:C++26 Disapproved
by bionhoward on Tuesday November 03, 2026 @10:57PM
(#50361346)
Oh im not a c++ guy but that actually looks pretty awesome because it’s like Hoare logic
Its a very inside baseball article. Contracts is a proposed C++ language feature for improving programmable assertions of program state. E.g. a better c++ version of C's assert function. That in theory will improve both safety and performance by letting people add more complex assertions (e.g. pre/post conditions) to functions.