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

Discussion

A compiler emitting intermediate code for an expression with side effects must

  • A.reject the expression as ambiguous and report an error
  • B.convert the expression into a sequence of procedure calls
  • C.fix the order in which the operands are evaluated
  • D.evaluate every operand exactly once before the operator

Answer: C

Correct answer: fix the order in which the operands are evaluated

Once an operand has a side effect, the order in which the operands are evaluated changes what the program does. Generating code fixes that order, so the compiler must choose one consistent with whatever the language guarantees - and where the language leaves it unspecified, two conforming compilers may legitimately differ.

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

Post your comment

Please log in or register to post a comment.