I remember reading that the correct way to check if an address is 0x0
or not is _addr == address(0)
and not _addr == 0
. However, I'm unable to find any difference between the two when I run the following:
pragma solidity ^0.4.19;
contract Test {
bool public isResult1 = false;
bool public isResult2 = false;
function isAddressZero1(address _addr) public {
isResult1 = (_addr == address(0));
}
function isAddressZero2(address _addr) public {
isResult2 = (_addr == 0);
}
}
Is there a known issue with _addr == 0
or is the explicit typecasting just to be safe?
_addr != 0x0
to make it easily identifiable in code.