aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2024-12-05 05:17:27 +0800
committerRunxi Yu <me@runxiyu.org>2024-12-05 05:17:27 +0800
commit2b4eae87464c250d386f0471a366da32876ce39e (patch)
tree1affdbcc2458a8a23e2f4ebbbd9785b609078a51 /README.md
parentPandoc (diff)
downloade2-spec-2b4eae87464c250d386f0471a366da32876ce39e.tar.gz
e2-spec-2b4eae87464c250d386f0471a366da32876ce39e.tar.zst
e2-spec-2b4eae87464c250d386f0471a366da32876ce39e.zip
Overflow update
Diffstat (limited to 'README.md')
-rw-r--r--README.md7
1 files changed, 5 insertions, 2 deletions
diff --git a/README.md b/README.md
index 3fe28d7..8d7936d 100644
--- a/README.md
+++ b/README.md
@@ -96,8 +96,9 @@ does not define an `onfail` section, you must wrap it in a `either {...} onfail
Integer overflow/underflow is *usually* undesirable behavior.
Simple arithmetic operators return two values. The first is the result of the
-operation, and the second is a boolean that represents whether an overflow
-occured. The second return may be ignored.
+operation, and the second is the overflowed part, which is a boolean in
+addition/subtraction and the carried part in multiplication; but for division,
+it is the remainder. The second return may be ignored.
Additionally, we define a new syntax for detecting integer overflow on a wider
scope:
@@ -110,6 +111,8 @@ try {
/* Do something else */
}
```
+The overflow is caught if and only if it is not handled at the point of the
+operation and has not been handled at an inner `on_overflow`.
## Other non-trivial differences from C