diff options
author | chriseth <c@ethdev.com> | 2017-01-26 23:28:44 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2017-01-26 23:40:24 +0800 |
commit | 7660736aa269c69a69ef728924f566d72661638a (patch) | |
tree | 578350d1a7e41e6d02a6aaf1db99a35ff7543924 /docs/control-structures.rst | |
parent | a98fa41897950b84b0217c9ce3c79c20009d0c8d (diff) | |
download | dexon-solidity-7660736aa269c69a69ef728924f566d72661638a.tar.gz dexon-solidity-7660736aa269c69a69ef728924f566d72661638a.tar.zst dexon-solidity-7660736aa269c69a69ef728924f566d72661638a.zip |
Document special case of zero-initialized internal function.
Diffstat (limited to 'docs/control-structures.rst')
-rw-r--r-- | docs/control-structures.rst | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst index a398d857..d7005717 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -394,8 +394,13 @@ Currently, Solidity automatically generates a runtime exception in the following #. If you perform an external function call targeting a contract that contains no code. #. If your contract receives Ether via a public function without ``payable`` modifier (including the constructor and the fallback function). #. If your contract receives Ether via a public accessor function. +#. If you call a zero-initialized variable of internal function type. -Internally, Solidity performs an "invalid jump" when a user-provided exception is thrown. In contrast, it performs an invalid (i.e., non-existent) operation if a runtime exception is encountered. In both cases, this 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. +Internally, Solidity performs an "invalid jump" when a user-provided exception is thrown. In contrast, it performs an invalid operation +(code ``0xfe``) if a runtime exception is encountered. In both cases, this 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. .. index:: ! assembly, ! asm, ! evmasm |