title: How to safely access memory mapped hardware register from C or C++ language level?
body: <p>In C and C++ I usually access memory mapped hardware registers with the well known pattern:</p>
  
  <pre><code>typedef unsigned int uint32_t;
  *((volatile uint32_t*)0xABCDEDCB) = value;
  </code></pre>
  
  <p>As far as I know, the only thing guaranteed by the C or C++ standard is that accesses to volatile variables are evaluated strictly according to the rules of the abstract machine.</p>
  
  <ol>
  <li>How can I be sure that the compiler will not generate torn stores for the access for a 32-bit processor? For example the compiler is allowed to emit two 16-bit stores instead of a one 32-bit store, isn't it?</li>
  <li>Are there any guarantees in this area made by gcc?</li>
  </ol>