aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-08-14 23:11:39 +0800
committerGitHub <noreply@github.com>2018-08-14 23:11:39 +0800
commit0e3cbea6f2a5d020bfbb973eda9587eec5a1626b (patch)
tree361285896070c3559f2ab67eed13300c2d0f55d2 /docs
parent315eec83bd9e66c02a37778a17889c05b49292c6 (diff)
parent1dc49788839f254b1f41a4f3d9286172a3c70bc8 (diff)
downloaddexon-solidity-0e3cbea6f2a5d020bfbb973eda9587eec5a1626b.tar
dexon-solidity-0e3cbea6f2a5d020bfbb973eda9587eec5a1626b.tar.gz
dexon-solidity-0e3cbea6f2a5d020bfbb973eda9587eec5a1626b.tar.bz2
dexon-solidity-0e3cbea6f2a5d020bfbb973eda9587eec5a1626b.tar.lz
dexon-solidity-0e3cbea6f2a5d020bfbb973eda9587eec5a1626b.tar.xz
dexon-solidity-0e3cbea6f2a5d020bfbb973eda9587eec5a1626b.tar.zst
dexon-solidity-0e3cbea6f2a5d020bfbb973eda9587eec5a1626b.zip
Merge pull request #4780 from ethereum/enumData
Clarify data representation of enums.
Diffstat (limited to 'docs')
-rw-r--r--docs/types.rst6
1 files changed, 5 insertions, 1 deletions
diff --git a/docs/types.rst b/docs/types.rst
index c216fd83..78451b39 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -368,6 +368,10 @@ Enums are one way to create a user-defined type in Solidity. They are explicitly
to and from all integer types but implicit conversion is not allowed. The explicit conversions
check the value ranges at runtime and a failure causes an exception. Enums needs at least one member.
+The data representation is the same as for enums in C: The options are represented by
+subsequent unsigned integer values starting from ``0``.
+
+
::
pragma solidity ^0.4.16;
@@ -384,7 +388,7 @@ check the value ranges at runtime and a failure causes an exception. Enums need
// Since enum types are not part of the ABI, the signature of "getChoice"
// will automatically be changed to "getChoice() returns (uint8)"
// for all matters external to Solidity. The integer type used is just
- // large enough to hold all enum values, i.e. if you have more values,
+ // large enough to hold all enum values, i.e. if you have more than 256 values,
// `uint16` will be used and so on.
function getChoice() public view returns (ActionChoices) {
return choice;