mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11675 from TransmissionsDev/patch-1
Remove incorrect statement that calldata must be used for external functions
This commit is contained in:
commit
f0d7ed98a5
@ -27,13 +27,6 @@ Every reference type has an additional
|
||||
annotation, the "data location", about where it is stored. There are three data locations:
|
||||
``memory``, ``storage`` and ``calldata``. Calldata is a non-modifiable,
|
||||
non-persistent area where function arguments are stored, and behaves mostly like memory.
|
||||
It is required for parameters of external functions but can also be used for other variables.
|
||||
|
||||
|
||||
.. note::
|
||||
Prior to version 0.5.0 the data location could be omitted, and would default to different locations
|
||||
depending on the kind of variable, function type, etc., but all complex types must now give an explicit
|
||||
data location.
|
||||
|
||||
.. note::
|
||||
If you can, try to use ``calldata`` as data location because it will avoid copies and
|
||||
@ -41,6 +34,17 @@ It is required for parameters of external functions but can also be used for oth
|
||||
data location can also be returned from functions, but it is not possible to
|
||||
allocate such types.
|
||||
|
||||
.. note::
|
||||
Prior to version 0.6.9 data location for reference-type arguments was limited to
|
||||
``calldata`` in external functions, ``memory`` in public functions and either
|
||||
``memory`` or ``storage`` in internal and private ones.
|
||||
Now ``memory`` and ``calldata`` are allowed in all functions regardless of their visibility.
|
||||
|
||||
.. note::
|
||||
Prior to version 0.5.0 the data location could be omitted, and would default to different locations
|
||||
depending on the kind of variable, function type, etc., but all complex types must now give an explicit
|
||||
data location.
|
||||
|
||||
.. _data-location-assignment:
|
||||
|
||||
Data location and assignment behaviour
|
||||
|
Loading…
Reference in New Issue
Block a user