68 - Implicit Conversions
An implicit type conversion is automatically applied by the compiler in some cases during assignments, when passing arguments to functions and when applying operators
-
implicit conversion between value-types is possible if it makes sense semantically and no information is lost
-
For example,
uint8
is convertible touint16
andint128
toint256
, butint8
is not convertible touint256
, becauseuint256
cannot hold values such as-1
- Type Conversion
- Compiler Appied
- Assignments/Arguments/Operators
- Semantic Sense
- No Information Lost
- E.g.:
uint8
->uint16
,int128
->int256
,int128 X
->uint256
,uint256 X
->uint128