doc: clarify the documentation of Assume

This commit is contained in:
ismaelsadeeq 2025-03-20 11:47:32 +01:00
parent 223fc24c4e
commit 329a0dcdaf
No known key found for this signature in database
GPG key ID: 0E3908F364989888

View file

@ -460,7 +460,10 @@ other input.
safely continue even if the assumption is violated. In debug builds it
behaves like `Assert`/`assert` to notify developers and testers about
nonfatal errors. In production it doesn't warn or log anything, though the
expression is always evaluated.
expression is always evaluated. However, if the compiler can prove that
an expression inside `Assume` is side-effect-free, it may optimize the call away,
skipping its evaluation in production. This enables a lower-cost way of
making explicit statements about the code, aiding review.
- For example it can be assumed that a variable is only initialized once,
but a failed assumption does not result in a fatal bug. A failed
assumption may or may not result in a slightly degraded user experience,