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

Discussion

A peripheral register read from C must be declared volatile so that the compiler

  • A.aligns the access to a word boundary
  • B.generates a memory barrier before every access
  • C.does not cache the value or remove repeated reads
  • D.places the variable in read-only memory

Answer: C

Without it the compiler is entitled to assume nothing else changes the location and may read it once, or not at all. The qualifier forbids that optimisation; it says nothing about ordering between separate accesses, which needs a barrier.

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

Post your comment

Please log in or register to post a comment.