diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/control-structures.rst | 6 | ||||
-rw-r--r-- | docs/frequently-asked-questions.rst | 17 |
2 files changed, 20 insertions, 3 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst index 72cf136d..2d959d1d 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -203,7 +203,7 @@ idea is that assembly libraries will be used to enhance the language in such way function at(address _addr) returns (bytes o_code) { assembly { // retrieve the size of the code, this needs assembly - let size := extcodesize(_addr); + let size := extcodesize(_addr) // allocate output byte array - this could also be done without assembly // by using o_code = new bytes(size) o_code := mload(0x40) @@ -427,7 +427,7 @@ Strings are stored left-aligned and cannot be longer than 32 bytes. assembly { 2 3 add "abc" and } -Functionaly Style +Functional Style ----------------- You can type opcode after opcode in the same way they will end up in bytecode. For example @@ -571,7 +571,7 @@ For both ways, the colon points to the name of the variable. let v := 0 // functional-style assignment as part of variable declaration let g := add(v, 2) sload(10) - := v // instruction style assignment, puts the result of sload(10) into v + =: v // instruction style assignment, puts the result of sload(10) into v } diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index 6ac5a9e9..fc7d7b7f 100644 --- a/docs/frequently-asked-questions.rst +++ b/docs/frequently-asked-questions.rst @@ -666,6 +666,23 @@ gas and return your 20 Wei). In the above example, the low-level function `call` is used to invoke another contract with `p.data` as payload and `p.amount` Wei is sent with that call. +What happens to a struct's mapping when copying over a struct? +============================================================== + +This is a very interesting question. Suppose that we have a contract field set up like such:: + + struct user{ + mapping(string => address) usedContracts; + } + function somefunction{ + user user1; + user1.usedContracts["Hello"] = "World"; + user user2 = user1; + } + +In this case, the mapping of the struct being copied over into the userList is ignored as there is no "list of mapped keys". +Therefore it is not possible to find out which values should be copied over. + How do I initialize a contract with only a specific amount of wei? ================================================================== |