diff options
author | Chris Chinchilla <chriswhward@gmail.com> | 2019-01-21 18:57:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-21 18:57:01 +0800 |
commit | da73e253988788ee0733425174e99520b320a7fd (patch) | |
tree | 9a5201e1dd1457932119ba50ebc6e55f8da3f814 /docs/frequently-asked-questions.rst | |
parent | 606c2b99456c6be4cb1f563edee5286787b67490 (diff) | |
parent | f39993ced653d6c34338e8aa85d7c664faa6af1d (diff) | |
download | dexon-solidity-da73e253988788ee0733425174e99520b320a7fd.tar.gz dexon-solidity-da73e253988788ee0733425174e99520b320a7fd.tar.zst dexon-solidity-da73e253988788ee0733425174e99520b320a7fd.zip |
Merge pull request #5797 from ethereum/faq-array-pass
[DOCS] Remove copy between contracts FAQ item
Diffstat (limited to 'docs/frequently-asked-questions.rst')
-rw-r--r-- | docs/frequently-asked-questions.rst | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index ff2f1fac..11db780c 100644 --- a/docs/frequently-asked-questions.rst +++ b/docs/frequently-asked-questions.rst @@ -96,36 +96,6 @@ In this example:: } } -Can a contract pass an array (static size) or string or ``bytes`` (dynamic size) to another contract? -===================================================================================================== - -Sure. Take care that if you cross the memory / storage boundary, -independent copies will be created:: - - pragma solidity >=0.4.16 <0.6.0; - - contract C { - uint[20] x; - - function f() public { - g(x); - h(x); - } - - function g(uint[20] memory y) internal pure { - y[2] = 3; - } - - function h(uint[20] storage y) internal { - 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. -On the other hand, ``h(x)`` successfully modifies ``x`` because only -a reference and not a copy is passed. - What does the following strange check do in the Custom Token contract? ====================================================================== |