does the or( || ) operator use short circuit evaluation?

just like the and( && ) operator?
Yes, the right operand will not be evaluated if the first was already true.
That is, assuming that the operator has not been overloaded. If it has, it's semantics will change because the order of evaluation of function arguments is not defined.
&& and || operator uses short circut evaluation and in C++ we should avoid them to overload.

operator && (func1,func2) will be called as (fun1 && fun2),in this case we don't know which func will execute first and that is not in sync with C,which says fun2 will be evaluated only if func1 is true.

Topic archived. No new replies allowed.