Exception handling (programming): Difference between revisions

Content deleted Content added
Line 145:
<syntaxhighlight lang="cpp">
int f(const int x)
pre (x != 1) // a precondition assertion
post(r : r == x && r != 2) // a postcondition assertion; r names the result object of f
{
contract_assert (x != 3); // an assertion statement
return x;
}