Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 897 Bytes

Implicit Conversions.md

File metadata and controls

22 lines (18 loc) · 897 Bytes

An implicit type conversion is automatically applied by the compiler in some cases during assignments, when passing arguments to functions and when applying operators

  1. implicit conversion between value-types is possible if it makes sense semantically and no information is lost

  2. For example, uint8 is convertible to uint16 and int128 to int256, but int8 is not convertible to uint256, because uint256 cannot hold values such as -1


Slide Screenshot

068.jpg


Slide Deck

  • Type Conversion
  • Compiler Appied
  • Assignments/Arguments/Operators
  • Semantic Sense
  • No Information Lost
  • E.g.: uint8 -> uint16, int128 -> int256, int128 X -> uint256, uint256 X -> uint128

References