Skip to content

Latest commit

 

History

History
18 lines (17 loc) · 894 Bytes

Pre-declaration usage of local variables.md

File metadata and controls

18 lines (17 loc) · 894 Bytes

Usage of a variable before its declaration (either declared later or in another scope) leads to unexpected behavior in solc < 0.5.0 but solc >= 0.5.0 implements C99-style scoping rules where variables can only be used after they have been declared and only in the same or nested scopes. (see here)


Slide Screenshot

041.jpg


Slide Text

  • Local Variables Pre-declaration Usage
  • Declared Later
  • Declared Another Scope
  • solc < 0.5.0 -> Undefined Behavior
  • solc >= 0.5.0 -> C99-Style Scoping Rules

References


Tags