Added some lost changes.

This commit is contained in:
chriseth 2015-12-07 23:31:58 +01:00
parent 99bb8a9740
commit 92c789a89c
3 changed files with 14 additions and 1 deletions

View File

@ -547,6 +547,13 @@ Can a regular (i.e. non-contract) ethereum account be closed permanently like a
No. Non-contract accounts "exist" as long as the private key is known by
someone or can be generated in some way.
What is the difference between `bytes` and `byte[]`?
====================================================
`bytes` is usually more efficient: When used as arguments to functions (i.e. in
CALLDATA) or in memory, every single element of a `byte[]` is padded to 32
bytes which wastes 31 bytes per element.
******************
Advanced Questions
******************

View File

@ -513,7 +513,7 @@ No::
x |= y&&z;
* Operators with a higher priority than others can exclude surrounding
whitespace in order to denote precidence. This is meant to allow for
whitespace in order to denote precedence. This is meant to allow for
improved readability for complex statement. You should always use the same
amount of whitespace on either side of an operator:

View File

@ -119,6 +119,10 @@ Dynamically-sized byte array
`string`:
Dynamically-sized UTF8-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:: literal, literal;integer
Integer Literals
@ -261,6 +265,8 @@ Variables of type `bytes` and `string` are special arrays. A `bytes` is similar
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.
.. note::
If you want to access the byte-representation of a string `s`, use
`bytes(s).length` / `bytes(s)[7] = 'x';`. Keep in mind