mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Brought warning to high priority
Update functions.rst Update for warning over note priority Updated units-and-global-variables.rst Updated file for warning over note priority Updated control-structures.rst Updated priority of warning over note Updated assembly.rst Updated priority of warning over code Updated introduction-to-smart-contracts.rst Updated priority of warning over note Update installing-solidity.rst Corrected control-structures.rst Corrected white space error Corrected whitespace Corrected whitespace introduction to smart contract
This commit is contained in:
committed by
vigneshkarthikeyan
parent
dd04a35c0e
commit
3d40152102
+10
-10
@@ -394,6 +394,16 @@ use ``x_slot``, and to retrieve the byte-offset you use ``x_offset``.
|
||||
|
||||
Local Solidity variables are available for assignments, for example:
|
||||
|
||||
.. warning::
|
||||
If you access variables of a type that spans less than 256 bits
|
||||
(for example ``uint64``, ``address``, ``bytes16`` or ``byte``),
|
||||
you cannot make any assumptions about bits not part of the
|
||||
encoding of the type. Especially, do not assume them to be zero.
|
||||
To be safe, always clear the data properly before you use it
|
||||
in a context where this is important:
|
||||
``uint32 x = f(); assembly { x := and(x, 0xffffffff) /* now use x */ }``
|
||||
To clean signed types, you can use the ``signextend`` opcode.
|
||||
|
||||
.. code::
|
||||
|
||||
pragma solidity >=0.4.11 <0.7.0;
|
||||
@@ -407,16 +417,6 @@ Local Solidity variables are available for assignments, for example:
|
||||
}
|
||||
}
|
||||
|
||||
.. warning::
|
||||
If you access variables of a type that spans less than 256 bits
|
||||
(for example ``uint64``, ``address``, ``bytes16`` or ``byte``),
|
||||
you cannot make any assumptions about bits not part of the
|
||||
encoding of the type. Especially, do not assume them to be zero.
|
||||
To be safe, always clear the data properly before you use it
|
||||
in a context where this is important:
|
||||
``uint32 x = f(); assembly { x := and(x, 0xffffffff) /* now use x */ }``
|
||||
To clean signed types, you can use the ``signextend`` opcode.
|
||||
|
||||
Labels
|
||||
------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user