2

I'm reading solidity document and cannot understand the meaning of "address: equivalent to uint160, except for the assumed interpretation and language typing." in the doc

Does anyone know what is the exactly meaning? Thanks in advance!

1

uint160 is the shortest unsigned integer which can hold 20 bytes of information - Ethereum addresses are 20 bytes in hexadecimal format. So you can convert an Ethereum address directly into uint160 and back.

What the latter part of the sentence says is that the address word has also a special meaning: it's a reserved keyword which implies an address used within the Ethereum network. And uint160 doesn't have any implied information except that it's an unsigned integer number. An address also have some special handling in Solidity, for example you can't give a function uint160 and implicitly cast it into an address - the cast has to be explicit.

Furthermore the uint160 equivalence can be used if you need to convert from address to address payable (https://solidity.readthedocs.io/en/v0.5.0/050-breaking-changes.html#explicitness-requirements).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.