diff options
author | Runxi Yu <me@runxiyu.org> | 2024-12-05 05:17:27 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2024-12-05 05:17:27 +0800 |
commit | 2b4eae87464c250d386f0471a366da32876ce39e (patch) | |
tree | 1affdbcc2458a8a23e2f4ebbbd9785b609078a51 /README.md | |
parent | Pandoc (diff) | |
download | e2-spec-2b4eae87464c250d386f0471a366da32876ce39e.tar.gz e2-spec-2b4eae87464c250d386f0471a366da32876ce39e.tar.zst e2-spec-2b4eae87464c250d386f0471a366da32876ce39e.zip |
Overflow update
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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 |