I don't think it ever was because bytes
is a dynamic array of byte
which means it has a length
. Is it possible you saw bytes32
conversion to unit
? That is totally acceptable in that both are 32-byte words.
This compiles under 0.4.25 as well 0.5.2.
contract Bytes {
function convert(bytes32 b) public pure returns(uint) {
return uint(b);
}
}
On the other hand, this conversion is trouble in all cases I'm aware of.
contract Bytes {
function convert(bytes b) public pure returns(uint) {
return uint(b);
}
}
In my opinion, conversion of bytes
and string
to numbers, string manipulation, etc. are problematic issues that should usually be dealt with by software clients rather than burdening contracts with such concerns. It's a case where the contract team should strongly resist overloading the contract with concerns that software clients are capable of resolving.
Hope it helps.