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

Discussion

Aliasing limits optimisation because

  • A.aliases always indicate an error in the source program
  • B.two names may refer to the same location, so a write to one affects both
  • C.aliased variables cannot be stored in memory at all
  • D.the compiler is quite unable to determine the types of the aliased names

Answer: B

If the compiler cannot prove two pointers are distinct it must assume they may coincide. That assumption blocks reordering, caching in registers and much else. Languages with restricted pointers give the optimiser far more freedom.

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

Post your comment

Please log in or register to post a comment.