title: How to cast const uint8_t* to char*
body: <p>I have a <code>const uint8_t*</code> that I want to convert to a <code>char*</code> for an interface that expects a <code>char*</code>.</p>
  
  <p>The easiest way to do this is with a C-style cast:</p>
  
  <pre><code>const uint8_t* aptr = &amp;some_buffer;
  char* bptr = (char*)aptr;
  </code></pre>
  
  <p>However, our internal style guide (which is based on the <a href="https://google.github.io/styleguide/cppguide.html#Casting" rel="nofollow noreferrer">Google C++ Style Guide</a>) bans C-style casts.</p>
  
  <p>Another option is this monstrosity, which I find pretty unreadable:</p>
  
  <pre><code>char *cptr = reinterpret_cast&lt;char*&gt;(const_cast&lt;uint8_t*&gt;(aptr));
  </code></pre>
  
  <p>These other options I tried all failed to compile:</p>
  
  <pre><code>char* dptr = reinterpret_cast&lt;char*&gt;(aptr);
  char* eptr = const_cast&lt;char*&gt;(aptr);
  char* fptr = static_cast&lt;char*&gt;(aptr);
  </code></pre>
  
  <p>Is there any way I can perform this cast using a C++-style cast without nesting two separate cast operations?</p>