diff options
author | chriseth <chris@ethereum.org> | 2016-08-25 03:15:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-25 03:15:07 +0800 |
commit | 9fc1bcb2becf48192e5c52d6af1fac2b88656f2d (patch) | |
tree | 85087d05bfb5955cee0804b5d2c093c9b6ea127d /docs/control-structures.rst | |
parent | d5e4b7492ebf28182d71e2bbc9aece24e4e16182 (diff) | |
parent | ef117c29021c31bc7f9c3e0b9797b72538591199 (diff) | |
download | dexon-solidity-9fc1bcb2becf48192e5c52d6af1fac2b88656f2d.tar.gz dexon-solidity-9fc1bcb2becf48192e5c52d6af1fac2b88656f2d.tar.zst dexon-solidity-9fc1bcb2becf48192e5c52d6af1fac2b88656f2d.zip |
Merge pull request #945 from Denton-L/fix-documentation
Minor corrections to documentation
Diffstat (limited to 'docs/control-structures.rst')
-rw-r--r-- | docs/control-structures.rst | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst index 73b0131f..b3940f72 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -127,11 +127,11 @@ Those names will still be present on the stack, but they are inaccessible. .. _creating-contracts: -Creating Contracts via new -========================== +Creating Contracts via ``new`` +============================== A contract can create a new contract using the ``new`` keyword. The full -code of the contract to be created has to be known and thus recursive +code of the contract being created has to be known and, thus, recursive creation-dependencies are now possible. :: @@ -142,6 +142,8 @@ creation-dependencies are now possible. x = a; } } + + contract C { D d = new D(4); // will be executed as part of C's constructor @@ -503,9 +505,9 @@ The opcodes ``pushi`` and ``jumpdest`` cannot be used directly. +-------------------------+------+-----------------------------------------------------------------+ | callvalue | | wei sent together with the current call | +-------------------------+------+-----------------------------------------------------------------+ -| calldataload(p) | | call data starting from position p (32 bytes) | +| calldataload(p) | | calldata starting from position p (32 bytes) | +-------------------------+------+-----------------------------------------------------------------+ -| calldatasize | | size of call data in bytes | +| calldatasize | | size of calldata in bytes | +-------------------------+------+-----------------------------------------------------------------+ | calldatacopy(t, f, s) | `-` | copy s bytes from calldata at position f to mem at position t | +-------------------------+------+-----------------------------------------------------------------+ @@ -520,14 +522,14 @@ The opcodes ``pushi`` and ``jumpdest`` cannot be used directly. | create(v, p, s) | | create new contract with code mem[p..(p+s)) and send v wei | | | | and return the new address | +-------------------------+------+-----------------------------------------------------------------+ -| call(g, a, v, in, | | call contract at address a with input mem[in..(in+insize)] | +| call(g, a, v, in, | | call contract at address a with input mem[in..(in+insize)) | | insize, out, outsize) | | providing g gas and v wei and output area | -| | | mem[out..(out+outsize)] returting 1 on error (out of gas) | +| | | mem[out..(out+outsize)) returning 1 on error (out of gas) | +-------------------------+------+-----------------------------------------------------------------+ -| callcode(g, a, v, in, | | identical to call but only use the code from a and stay | +| callcode(g, a, v, in, | | identical to `call` but only use the code from a and stay | | insize, out, outsize) | | in the context of the current contract otherwise | +-------------------------+------+-----------------------------------------------------------------+ -| delegatecall(g, a, in, | | identical to callcode but also keep ``caller`` | +| delegatecall(g, a, in, | | identical to `callcode` but also keep ``caller`` | | insize, out, outsize) | | and ``callvalue`` | +-------------------------+------+-----------------------------------------------------------------+ | return(p, s) | `*` | end execution, return data mem[p..(p+s)) | |