title: What is the correct typedef for an opaque C pointer to a C++ class?
body: <p>There are dozens upon dozens of SO questions and blog posts that describe wrapping a C++ class with a C API. Example <a href="https://stackoverflow.com/questions/1588788/wrapping-c-class-api-for-c-consumption">Wrapping C++ class API for C consumption</a></p>
  
  <p>Most of these answers and blogposts go for something like this:</p>
  
  <pre><code>typedef void* CMyClass;
  </code></pre>
  
  <p>But others say that this is bad because it provides no type safety. They propose various variations of opaque structs, without any explanation. I could just copy the above snippet and move on with my life (which I will do in the meantime), but I'd like to know once and for all</p>
  
  <ul>
  <li>Which form is the best?</li>
  <li>Which guarantees does it provide over <code>void*</code>?</li>
  <li>How does it work?</li>
  </ul>