Document byte[] vs bytes

This commit is contained in:
Alex Beregszaszi
2017-09-01 19:09:36 +01:00
parent 8743b2cead
commit f787ecae5a
2 changed files with 4 additions and 7 deletions
-7
View File
@@ -441,13 +441,6 @@ The correct way to do this is the following::
}
}
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.
Is it possible to send a value while calling an overloaded function?
====================================================================
+4
View File
@@ -181,6 +181,10 @@ Members:
* ``.length`` yields the fixed length of the byte array (read-only).
.. note::
It is possible to use an array of bytes as ``byte[]``, but it is wasting a lot of space, 31 bytes every element,
to be exact, when passing in calls. It is better to use ``bytes``.
Dynamically-sized byte array
----------------------------