mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Layout cleanup.
This commit is contained in:
parent
65026a0a25
commit
af09cb3af2
@ -19,6 +19,8 @@ For contracts that use inheritance, the ordering of state variables is determine
|
||||
C3-linearized order of contracts starting with the most base-ward contract. If allowed
|
||||
by the above rules, state variables from different contracts do share the same storage slot.
|
||||
|
||||
The elements of structs and arrays are stored after each other, just as if they were given explicitly.
|
||||
|
||||
.. warning::
|
||||
When using elements that are smaller than 32 bytes, your contract's gas usage may be higher.
|
||||
This is because the EVM operates on 32 bytes at a time. Therefore, if the element is smaller
|
||||
@ -36,7 +38,7 @@ by the above rules, state variables from different contracts do share the same s
|
||||
``uint128, uint256, uint128``, as the former will only take up two slots of storage whereas the
|
||||
latter will take up three.
|
||||
|
||||
.. note::
|
||||
.. note::
|
||||
The layout of state variables in storage is considered to be part of the external interface
|
||||
of Solidity due to the fact that storage pointers can be passed to libraries. This means that
|
||||
any change to the rules outlined in this section is considered a breaking change
|
||||
@ -44,8 +46,6 @@ by the above rules, state variables from different contracts do share the same s
|
||||
being executed.
|
||||
|
||||
|
||||
The elements of structs and arrays are stored after each other, just as if they were given explicitly.
|
||||
|
||||
Mappings and Dynamic Arrays
|
||||
===========================
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user