Created
February 3, 2017 13:44
-
-
Save sciguy16/b12a625decccec7d0238a2179e1855da to your computer and use it in GitHub Desktop.
Contract for testing the order with which Solidity evaluates arguments to functions. This is explicitly declared to be unpredictable in the documentation.
This file contains 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.2; | |
contract EvaluationOrder { | |
uint flag; | |
uint[] flags; | |
function EvaluationOrder(){ | |
flag=1; | |
} | |
function callFunctionWithMultipleArguments(){ | |
functionWithMultipleArguments(flagsPush(1),flagsPush(20),flagsPush(300),flagsPush(4000)); | |
} | |
function functionWithMultipleArguments(uint a, uint b, uint c, uint d) returns (uint,uint,uint,uint){ | |
return (a,b,c,d); | |
} | |
function flagsPush(uint x) returns (uint){ | |
flags.push(flag+x); | |
flag = flag + 100000; | |
return x; | |
} | |
function getFlags() returns (uint[]){ | |
return flags; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment