diff options
author | chriseth <chris@ethereum.org> | 2018-05-24 00:11:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-24 00:11:20 +0800 |
commit | 5ee2ce353edfddbf925e775b321247246d150593 (patch) | |
tree | 5803f4c77e989f9b778d3702e82cdcfc8a897e0a /docs | |
parent | 6d08341942763730ba19c882520a4f45bb350b20 (diff) | |
parent | 87a838583290d66f4d4d78149a6d7398a41750ec (diff) | |
download | dexon-solidity-5ee2ce353edfddbf925e775b321247246d150593.tar dexon-solidity-5ee2ce353edfddbf925e775b321247246d150593.tar.gz dexon-solidity-5ee2ce353edfddbf925e775b321247246d150593.tar.bz2 dexon-solidity-5ee2ce353edfddbf925e775b321247246d150593.tar.lz dexon-solidity-5ee2ce353edfddbf925e775b321247246d150593.tar.xz dexon-solidity-5ee2ce353edfddbf925e775b321247246d150593.tar.zst dexon-solidity-5ee2ce353edfddbf925e775b321247246d150593.zip |
Merge pull request #4067 from ethereum/050
[BREAKING] Version 0.5.0
Diffstat (limited to 'docs')
-rw-r--r-- | docs/contracts.rst | 2 | ||||
-rw-r--r-- | docs/types.rst | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst index b73fe2ca..00ef3fc6 100644 --- a/docs/contracts.rst +++ b/docs/contracts.rst @@ -802,7 +802,7 @@ as topics. The event call above can be performed in the same way as log3( bytes32(msg.value), bytes32(0x50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb20), - bytes32(msg.sender), + bytes32(uint256(msg.sender)), _id ); } diff --git a/docs/types.rst b/docs/types.rst index 5c20dc67..3f799c32 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -762,7 +762,7 @@ Members // Create a dynamic byte array: bytes memory b = new bytes(200); for (uint i = 0; i < b.length; i++) - b[i] = byte(i); + b[i] = byte(uint8(i)); return b; } } @@ -975,6 +975,15 @@ cut off:: uint32 a = 0x12345678; uint16 b = uint16(a); // b will be 0x5678 now +Since 0.5.0 explicit conversions between integers and fixed-size byte arrays +are only allowed, if both have the same size. To convert between integers and +fixed-size byte arrays of different size, they first have to be explicitly +converted to a matching size. This makes alignment and padding explicit:: + + uint16 x = 0xffff; + bytes32(uint256(x)); // pad on the left + bytes32(bytes2(x)); // pad on the right + .. index:: ! type;deduction, ! var .. _type-deduction: |