diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2018-08-14 23:39:18 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-08-15 03:42:01 +0800 |
commit | 4f3f4a916ba8a496fcfa2b36342e37b3f1fc6712 (patch) | |
tree | 75d8f83f8ed8d48a960ae33781fa17a55b50e111 /docs/frequently-asked-questions.rst | |
parent | cc54f6c4256cdccf4b25586ed63800caa836d9c6 (diff) | |
download | dexon-solidity-4f3f4a916ba8a496fcfa2b36342e37b3f1fc6712.tar.gz dexon-solidity-4f3f4a916ba8a496fcfa2b36342e37b3f1fc6712.tar.zst dexon-solidity-4f3f4a916ba8a496fcfa2b36342e37b3f1fc6712.zip |
Extend documentation about explicit and implicit conversions between (u)intXX, bytesYY and literals.
Diffstat (limited to 'docs/frequently-asked-questions.rst')
-rw-r--r-- | docs/frequently-asked-questions.rst | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst index b26ff527..2c5f8661 100644 --- a/docs/frequently-asked-questions.rst +++ b/docs/frequently-asked-questions.rst @@ -446,6 +446,25 @@ does not fit inside this range, it is truncated. These truncations can have above is necessary to avoid certain attacks. +Why are explicit conversions between fixed-size bytes types and integer types failing? +====================================================================================== + +Since version 0.5.0 explicit conversions between fixed-size byte arrays and integers are only allowed, +if both types have the same size. This prevents unexpected behaviour when truncating or padding. +Such conversions are still possible, but intermediate casts are required that make the desired +truncation and padding convention explicit. See :ref:`types-conversion-elementary-types` for a full +explanation and examples. + + +Why can number literals not be converted to fixed-size bytes types? +=================================================================== + +Since version 0.5.0 only hexadecimal number literals can be converted to fixed-size bytes +types and only if the number of hex digits matches the size of the type. See :ref:`types-conversion-literals` +for a full explanation and examples. + + + More Questions? =============== |