“IF” argument evaluation order?

前端 未结 6 874
小鲜肉
小鲜肉 2020-12-02 18:17
if(a && b)
{
  do something;
}

is there any possibility to evaluate arguments from right to left(b -> a)?

if \"yes\", what influenc

6条回答
  •  独厮守ぢ
    2020-12-02 19:11

    Every value computation and side effect of the first (left) argument of the built-in logical AND operator && and the built-in logical OR operator || is sequenced before every value computation and side effect of the second (right) argument.

    Read here for a more exhaustive explanation of the rules set: order evaluation

提交回复
热议问题