aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2017-03-02 21:41:51 +0800
committerchriseth <c@ethdev.com>2017-03-13 20:30:23 +0800
commit4077e56a2fad49227e7fe4c1ed4ff81462fc6a9a (patch)
tree6098c507399398fcf3d6fbae27fc5915f69e3ed1 /docs
parentfdc41f3b07c48438fcdd703a4dd1bd2f75736dc0 (diff)
downloaddexon-solidity-4077e56a2fad49227e7fe4c1ed4ff81462fc6a9a.tar.gz
dexon-solidity-4077e56a2fad49227e7fe4c1ed4ff81462fc6a9a.tar.zst
dexon-solidity-4077e56a2fad49227e7fe4c1ed4ff81462fc6a9a.zip
Documentation.
Diffstat (limited to 'docs')
-rw-r--r--docs/contracts.rst11
1 files changed, 5 insertions, 6 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst
index 1516ba0b..52dd440a 100644
--- a/docs/contracts.rst
+++ b/docs/contracts.rst
@@ -428,8 +428,10 @@ change by overriding).
Constant State Variables
************************
-State variables can be declared as constant (this is not yet implemented
-for array and struct types and not possible for mapping types).
+State variables can be declared as constant. In this case, they have to be
+assigned a value or expression which is a constant at compile time. The compiler does
+not reserve a storage slot for these variables and every occurrence is
+replaced by their constant value (which might be computed by the optimizer).
::
@@ -438,12 +440,9 @@ for array and struct types and not possible for mapping types).
contract C {
uint constant x = 32**22 + 8;
string constant text = "abc";
+ bytes32 constant myHash = keccak256("abc");
}
-This has the effect that the compiler does not reserve a storage slot
-for these variables and every occurrence is replaced by their constant value.
-
-The value expression can only contain integer arithmetics.
******************
Constant Functions