From c7ffbf497612272cb53b3de930747328fa4c54d9 Mon Sep 17 00:00:00 2001 From: Herb Sutter Date: Wed, 21 Aug 2024 10:26:58 -0700 Subject: [PATCH] Clarify postcondition capture/evaluation Closes #1239 --- docs/cpp2/contracts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cpp2/contracts.md b/docs/cpp2/contracts.md index 61183ef60..b197073ad 100644 --- a/docs/cpp2/contracts.md +++ b/docs/cpp2/contracts.md @@ -5,7 +5,7 @@ Cpp2 currently supports three kinds of contracts: -- **Preconditions and postconditions.** A function declaration can include `pre(condition)` and `post(condition)` before the `= /* function body */`. Before entering the function body, preconditions are fully evaluated and postconditions are captured (and performs their captures, if any). Immediately before exiting the function body via a normal return, postconditions are evaluated. If the function exits via an exception, postconditions are not evaluated. +- **Preconditions and postconditions.** A function declaration can include `pre(condition)` and `post(condition)` before the `= /* function body */`. Before entering the function body, preconditions are fully evaluated and postconditions are captured as function expressions to be evaluated later (and perform their captures of values on entry, if any). Immediately before exiting the function body via a normal return, postconditions are evaluated. If the function exits via an exception, postconditions are not evaluated. - **Assertions.** A function body can write `assert(condition)` assertion statements. Assertions are evaluated when control flow passes through them.