On 4/6/22 03:28, Bernhard Voelker wrote:
Well, it was an argument to say that & eliminates a conditional execution
branch, but if both sides of the & operator have to be evaluated

They don't. Neither operand has side effects, so a compiler can evaluate either operand and not bother to evaluate the other operand if the evaluated operand is false.

Not that I expect compilers to do that in this particular case, as on today's processors it can be faster to evaluate both sides unconditionally. The hardware evaluates the two sides in parallel and this is way faster than a branch predictor miss.

calling the 2nd function is much more
overhead than the savings of & over &&, right?

No, as the functions are inlined so there is no function call overhead.

Reply via email to