aboutsummaryrefslogtreecommitdiffstats
path: root/docs/frequently-asked-questions.rst
diff options
context:
space:
mode:
authorDenton Liu <liu.denton+github@gmail.com>2016-05-18 23:05:28 +0800
committerDenton Liu <liu.denton+github@gmail.com>2016-05-18 23:35:32 +0800
commit7c22a387f34d5cbc92b6b6ed78c281a480ba7739 (patch)
tree8300e1a97cc6537ff463ef705a5b28b313cfb6a0 /docs/frequently-asked-questions.rst
parentff26ea6c08a400192c5a5fff581a7ce649f717bd (diff)
downloaddexon-solidity-7c22a387f34d5cbc92b6b6ed78c281a480ba7739.tar.gz
dexon-solidity-7c22a387f34d5cbc92b6b6ed78c281a480ba7739.tar.zst
dexon-solidity-7c22a387f34d5cbc92b6b6ed78c281a480ba7739.zip
Changed whitespace formatting
Diffstat (limited to 'docs/frequently-asked-questions.rst')
-rw-r--r--docs/frequently-asked-questions.rst30
1 files changed, 16 insertions, 14 deletions
diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst
index 1b78d666..ff4d6fc0 100644
--- a/docs/frequently-asked-questions.rst
+++ b/docs/frequently-asked-questions.rst
@@ -692,11 +692,11 @@ 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{
+ struct user {
mapping(string => address) usedContracts;
}
- function somefunction{
+ function somefunction {
user user1;
user1.usedContracts["Hello"] = "World";
user user2 = user1;
@@ -715,6 +715,8 @@ You will need to make sure that you have both contracts aware of each other's pr
In this example::
contract B {}
+
+
contract A {
address child;
@@ -758,21 +760,21 @@ Sure. Take care that if you cross the memory / storage boundary,
independent copies will be created::
contract C {
- uint[20] x;
+ uint[20] x;
- function f() {
- g(x);
- h(x);
- }
+ function f() {
+ g(x);
+ h(x);
+ }
- function g(uint[20] y) {
- y[2] = 3;
- }
+ function g(uint[20] y) {
+ y[2] = 3;
+ }
- function h(uint[20] storage y) {
- y[3] = 4;
- }
- }
+ function h(uint[20] storage y) {
+ y[3] = 4;
+ }
+ }
The call to `g(x)` will not have an effect on `x` because it needs
to create an independent copy of the storage value in memory