aboutsummaryrefslogtreecommitdiffstats
path: root/docs/control-structures.rst
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-12-14 23:31:28 +0800
committerGitHub <noreply@github.com>2016-12-14 23:31:27 +0800
commit18f8f29c0a3ed9404f2950c11d77f85d0117c6d5 (patch)
tree11fcb5408f609ab3e8f35d7e41fd7a42df0d1837 /docs/control-structures.rst
parente53d12557162275a135a4ae086ae05691bc23fa3 (diff)
parent08a11e309f241e602cc4754b6322e4bb0da57b17 (diff)
downloaddexon-solidity-18f8f29c0a3ed9404f2950c11d77f85d0117c6d5.tar
dexon-solidity-18f8f29c0a3ed9404f2950c11d77f85d0117c6d5.tar.gz
dexon-solidity-18f8f29c0a3ed9404f2950c11d77f85d0117c6d5.tar.bz2
dexon-solidity-18f8f29c0a3ed9404f2950c11d77f85d0117c6d5.tar.lz
dexon-solidity-18f8f29c0a3ed9404f2950c11d77f85d0117c6d5.tar.xz
dexon-solidity-18f8f29c0a3ed9404f2950c11d77f85d0117c6d5.tar.zst
dexon-solidity-18f8f29c0a3ed9404f2950c11d77f85d0117c6d5.zip
Merge pull request #1487 from ethereum/shift-ops
Shift operators
Diffstat (limited to 'docs/control-structures.rst')
-rw-r--r--docs/control-structures.rst19
1 files changed, 10 insertions, 9 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index 974a093f..0802c085 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -382,17 +382,18 @@ In the following example, we show how ``throw`` can be used to easily revert an
}
}
-Currently, there are situations, where exceptions happen automatically in Solidity:
+Currently, Solidity automatically generates a runtime exception in the following situations:
1. If you access an array at a too large or negative index (i.e. ``x[i]`` where ``i >= x.length`` or ``i < 0``).
-2. If you access a fixed-length ``bytesN`` at a too large or negative index.
-3. If you call a function via a message call but it does not finish properly (i.e. it runs out of gas, has no matching function, or throws an exception itself), except when a low level operation ``call``, ``send``, ``delegatecall`` or ``callcode`` is used. The low level operations never throw exceptions but indicate failures by returning ``false``.
-4. If you create a contract using the ``new`` keyword but the contract creation does not finish properly (see above for the definition of "not finish properly").
-5. If you divide or modulo by zero (e.g. ``5 / 0`` or ``23 % 0``).
-6. If you convert a value too big or negative into an enum type.
-7. If you perform an external function call targeting a contract that contains no code.
-8. If your contract receives Ether via a public function without ``payable`` modifier (including the constructor and the fallback function).
-9. If your contract receives Ether via a public accessor function.
+1. If you access a fixed-length ``bytesN`` at a too large or negative index.
+1. If you call a function via a message call but it does not finish properly (i.e. it runs out of gas, has no matching function, or throws an exception itself), except when a low level operation ``call``, ``send``, ``delegatecall`` or ``callcode`` is used. The low level operations never throw exceptions but indicate failures by returning ``false``.
+1. If you create a contract using the ``new`` keyword but the contract creation does not finish properly (see above for the definition of "not finish properly").
+1. If you divide or modulo by zero (e.g. ``5 / 0`` or ``23 % 0``).
+1. If you shift by a negative amount.
+1. If you convert a value too big or negative into an enum type.
+1. If you perform an external function call targeting a contract that contains no code.
+1. If your contract receives Ether via a public function without ``payable`` modifier (including the constructor and the fallback function).
+1. If your contract receives Ether via a public accessor function.
Internally, Solidity performs an "invalid jump" when an exception is thrown and thus causes the EVM to revert all changes made to the state. The reason for this is that there is no safe way to continue execution, because an expected effect did not occur. Because we want to retain the atomicity of transactions, the safest thing to do is to revert all changes and make the whole transaction (or at least call) without effect.