You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pragma solidity^0.4.24;
contractA {
uint a;
uint b;
uint c;
function init() public{
a =10;
b =10;
c =20;
}
function t() publicviewreturns(uintres){
res = a * b / c;
}
function u() publicreturns(uint){
a +=1;
return a;
}
function v() publicreturns(uint){
a +=2;
return a;
}
function w() publicreturns(uint){
returnu() *v();
}
}
I understand that the result of
init();
w();
is unspecified, given that either u() or v() could be evaluated first (last I tried, v() was evaluated first).
Is this correct? Adding such an example to the documentation could help.
Similarly, is the result of:
init();
t();
also unspecified? More precisely, given an expression containing operators of equal precedence (* and /), is the evaluation order unspecified, or is it guaranteed to be from left to right?
The text was updated successfully, but these errors were encountered:
Given http://solidity.readthedocs.io/en/latest/control-structures.html#order-of-evaluation-of-expressions and given this example:
I understand that the result of
is unspecified, given that either
u()
orv()
could be evaluated first (last I tried,v()
was evaluated first).Is this correct? Adding such an example to the documentation could help.
Similarly, is the result of:
also unspecified? More precisely, given an expression containing operators of equal precedence (
*
and/
), is the evaluation order unspecified, or is it guaranteed to be from left to right?The text was updated successfully, but these errors were encountered: