title: Proper way of casting pointer types
body: <p>Considering the <a href="http://blogs.msdn.com/b/oldnewthing/archive/2005/05/19/420038.aspx" rel="noreferrer">following code</a> (and the fact that <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa366887%28v=vs.85%29.aspx" rel="noreferrer"><code>VirtualAlloc()</code> returns a <code>void*</code></a>):</p>
  
  <pre><code>BYTE* pbNext = reinterpret_cast&lt;BYTE*&gt;(
      VirtualAlloc(NULL, cbAlloc, MEM_COMMIT, PAGE_READWRITE));
  </code></pre>
  
  <p>why is <code>reinterpret_cast</code> chosen instead of <code>static_cast</code>?</p>
  
  <p>I used to think that <code>reinterpret_cast</code> is OK for e.g. casting pointers to and from integer types (like e.g. <code>DWORD_PTR</code>), but to cast from a <code>void*</code> to a <code>BYTE*</code>, isn't <code>static_cast</code> OK?</p>
  
  <p>Are there any (subtle?) differences in this particular case, or are they just both valid pointer casts?</p>
  
  <p>Does the C++ standard have a preference for this case, suggesting a way instead of the other?</p>