logoalt Hacker News

hankbond • today at 3:16 AM • 2 replies • view on HN

Maybe my reading comprehension has just nosedived but I could not find where this article discusses what the heck Contracts refers to?


Replies

AlotOfReading • today at 3:19 AM

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.

[0] https://en.cppreference.com/cpp/language/contracts

➕ show 1 reply
SolarNet • today at 3:22 AM

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.