Created
June 5, 2018 15:55
-
-
Save jigar23/194af74e10fcad92e6561bd9b2f488b2 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.23+commit.124ca40d.js&optimize=false&gist=
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.0; | |
contract Debugging { | |
uint[] private vars; | |
function assignment() public pure { | |
// allocates the memory first before assigning | |
// so we'll see 2 values in the stack first | |
// and then the assignment takes place | |
uint myValue1 = 1; | |
uint myValue2 = 2; | |
assert(myValue1 == myValue2); | |
} | |
function memoryAlloc() public pure { | |
string memory myString = "test1"; | |
string memory myString1 = "hello"; | |
assert(bytes(myString).length == 10); | |
} | |
// LEngth of array stored first | |
// then the array value | |
// As the length expands since its a dynamic array, the length | |
// value will be modified | |
function storageAlloc() public { | |
vars.push(2); | |
vars.push(4); | |
assert(vars.length == 4); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment