Skip to content

Commit

Permalink
[SQUASH] Update documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseth committed Oct 15, 2020
1 parent f3a5689 commit 324e097
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/control-structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,15 @@ In any case, you will get a warning about the outer variable being shadowed.
Checked or Unchecked Arithmetic
===============================

An overflow or underflow is the situation where the resulting value of an arithmetic operation,
when executed on an unrestricted integer, falls outside the range of the result type.

Prior to Solidity 0.8.0, arithmetic operations would always wrap in case of
under- or overflow leading to widespread use of libraries that would introduce
under- or overflow leading to widespread use of libraries that introduce
additional checks.

Since Solidity 0.8.0, all arithmetic operations revert on over- and underflow by default.
Since Solidity 0.8.0, all arithmetic operations revert on over- and underflow by default,
thus making the use of these libraries unnecessary.

To obtain the previous behaviour, an ``unchecked`` block can be used:

Expand Down Expand Up @@ -516,9 +520,6 @@ Functions called from within an ``unchecked`` block do not inherit the property.
.. note::
To avoid ambiguity, you cannot use ``_;`` inside an ``unchecked`` block.

An overflow or underflow is the situation where the resulting value of an arithmetic operation,
when executed on an unrestricted integer, falls outside the range of the result type.

The following operators will cause a failing assertion on overflow or underflow
and will wrap without an error if used inside an unchecked block:

Expand Down

0 comments on commit 324e097

Please sign in to comment.