In the book Jumping into C++ the author states that when doing comparisons between expressions (x != 0 && 10/x <5) the first comparison if returned false would short circuit the comparison stopping any chance of having a dived by 0 occurrence....
the author then goes on to state
Order of evaluation
if(username == "root" && password == "xyzzy")
In the previous example, there are several sub-expressions, including
username == "root"
password == "xyzzy"
Both of these expressions are evaluated before the Boolean operator.
Iam confused, if the above statement about short circuiting is true how can the 2nd statement made by the author also be true? I thought the evaluations were done sequentially and tested and only if the 1st is true would the 2nd be evaluated...
Any assistance or clarification would be most appreciated.