From 2b4eae87464c250d386f0471a366da32876ce39e Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 5 Dec 2024 05:17:27 +0800 Subject: Overflow update --- README.md | 7 +++++-- 1 file 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 -- cgit v1.2.3