consider this code (C++) :
int x = -4 , y = 5 ;
bool result = x > 0 && y++ < 10 ;
the expression (x > 0) will be evaluated first , and because (x > 0 = false) and due to short-circuit evaluation , the other expression (y++ < 10) won't be evaluated and the value of y will remain 5 .
now consider the following code :
int x = -4 , y = 5 ;
bool result = (x > 0) && (y++ < 10) ;
it is expected that the expressions in parentheses will be evaluated first so that before the logical AND is performed , the expression (y++ < 10) would have been evaluated and the value of y has became 6 , but the reality is that the value of y remains 5 . which means that even with the parentheses the evaluation is short-circuited and the expression (y++ < 10) is ignored .
What is the explanation for this case ?!