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

Discussion

Address computation for arrays is usually rearranged so that

  • A.the part depending only on the declaration is computed once
  • B.every multiplication is replaced by a shift instruction
  • C.the index expression is evaluated at compile time
  • D.the array bounds are checked before every access

Answer: A

Splitting the address into a constant part and an index dependent part lets the constant be folded at compile time. Only the varying portion then needs computing at run time. For a loop over an array the saving is repeated on every iteration.

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

Post your comment

Please log in or register to post a comment.