From 4077e56a2fad49227e7fe4c1ed4ff81462fc6a9a Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 2 Mar 2017 14:41:51 +0100 Subject: Documentation. --- docs/contracts.rst | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'docs') 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 -- cgit