Machine-translated by Google. Questions are authored in English.
Top

Discussion

Short circuit evaluation of a and b means that b

  • A.is not evaluated at all when a is false
  • B.is evaluated first and a only afterwards
  • C.is always evaluated before the jump is taken
  • D.must be a constant known at compile time

Answer: A

Once a is false the whole conjunction is false. Skipping b saves work and, more importantly, avoids any side effects the language guarantees will not happen. A call or an assignment hidden in the second operand simply never runs.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.