diff options
author | chriseth <chris@ethereum.org> | 2018-07-13 00:00:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-13 00:00:05 +0800 |
commit | 81271801b4560c15911b69a9f6d7e0530359f523 (patch) | |
tree | 9e52f36778ee877b1dc2fdf9b532b8aae39f369c /docs | |
parent | 0dd79bc1724bfd5031dd6d1bc3b4c1eda283b5f3 (diff) | |
parent | df8bbffd8e5b16d29f71860e1c3c851dd65693c4 (diff) | |
download | dexon-solidity-81271801b4560c15911b69a9f6d7e0530359f523.tar.gz dexon-solidity-81271801b4560c15911b69a9f6d7e0530359f523.tar.zst dexon-solidity-81271801b4560c15911b69a9f6d7e0530359f523.zip |
Merge pull request #4478 from ethereum/requireStorageLocation
Turn missing storage locations into an error.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/frequently-asked-questions.rst | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index e64849ea..17e71747 100644 --- a/docs/frequently-asked-questions.rst +++ b/docs/frequently-asked-questions.rst @@ -273,9 +273,11 @@ of variable it concerns: * state variables are always in storage * function arguments are in memory by default -* local variables of struct, array or mapping type reference storage by default +* local variables of mapping type reference storage by default * local variables of value type (i.e. neither array, nor struct nor mapping) are stored in the stack +For local variables of struct or array type the storage location has to be stated explicitly. + Example:: pragma solidity ^0.4.0; @@ -309,8 +311,9 @@ carry back to ``data1`` or ``data2``. .. warning:: Prior to version 0.5.0, a common mistake was to declare a local variable and assume that it will be created in memory, although it will be created in storage. Using such a variable without initializing - it could lead to unexpected behavior. Starting from 0.5.0, however, storage variables have to be initialized, - which should prevent these kinds of mistakes. + could lead to unexpected behavior. Starting from 0.5.0, however, the storage location for local variables + has to be specified explicitly and local storage variables have to be initialized, which should prevent + these kinds of mistakes. ****************** Advanced Questions |