diff options
author | chriseth <chris@ethereum.org> | 2018-06-05 01:02:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-05 01:02:00 +0800 |
commit | d0049489299d1d2437be6531998aaab2838874ce (patch) | |
tree | 1cd63b7bc9eefb9641f8199ff0c02a68510a8d4c | |
parent | c59a06bb97081f95885ce7c0c076d4290c26cd38 (diff) | |
parent | 78b8baede77088f41e84fe88ab5c8a9d7dc4f162 (diff) | |
download | dexon-solidity-d0049489299d1d2437be6531998aaab2838874ce.tar dexon-solidity-d0049489299d1d2437be6531998aaab2838874ce.tar.gz dexon-solidity-d0049489299d1d2437be6531998aaab2838874ce.tar.bz2 dexon-solidity-d0049489299d1d2437be6531998aaab2838874ce.tar.lz dexon-solidity-d0049489299d1d2437be6531998aaab2838874ce.tar.xz dexon-solidity-d0049489299d1d2437be6531998aaab2838874ce.tar.zst dexon-solidity-d0049489299d1d2437be6531998aaab2838874ce.zip |
Merge pull request #4201 from wjmelements/bytes-complex-type
move bytes and string to arrays section
-rw-r--r-- | docs/types.rst | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/docs/types.rst b/docs/types.rst index b3631f74..08b74241 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -226,10 +226,6 @@ Dynamically-sized byte array ``string``: Dynamically-sized UTF-8-encoded string, see :ref:`arrays`. Not a value-type! -As a rule of thumb, use ``bytes`` for arbitrary-length raw byte data and ``string`` -for arbitrary-length string (UTF-8) data. If you can limit the length to a certain -number of bytes, always use one of ``bytes1`` to ``bytes32`` because they are much cheaper. - .. index:: address, literal;address .. _address_literals: @@ -602,8 +598,10 @@ shaves off one level in the type from the right). Variables of type ``bytes`` and ``string`` are special arrays. A ``bytes`` is similar to ``byte[]``, but it is packed tightly in calldata. ``string`` is equal to ``bytes`` but does not allow length or index access (for now). - So ``bytes`` should always be preferred over ``byte[]`` because it is cheaper. +As a rule of thumb, use ``bytes`` for arbitrary-length raw byte data and ``string`` +for arbitrary-length string (UTF-8) data. If you can limit the length to a certain +number of bytes, always use one of ``bytes1`` to ``bytes32`` because they are much cheaper. .. note:: If you want to access the byte-representation of a string ``s``, use |