Pre-C++11 we know that short-circuiting and evaluation order are required for operator &&
because of:
1.9.18
In the evaluation of the following expressions
a && b a || b a ? b : c a , b
using the built-in meaning of the operators in these expressions, there is a sequence point after the evaluation of the first expression (12).
But sequence points no longer exist in C++11, so where is the standard part that says:
if (ptr && ptr->do_something())
{
}
is safe?
operator ,
can't possibly short circuit.) You still need the actual operator spec to guarantee that. – Heterozygote