title: How to update a C/C++ struct with compatibility
body: <p>I have a <code>struct</code> defined in a historical library with alas, an unfortunate choice of type: <code>unsigned char *</code> instead of <code>char*</code>.</p>
  <pre><code>struct MyStruct {
  
    unsigned char * myMember;
  };
  </code></pre>
  <p>This <code>struct</code> is used by a huge number of C applications and, more and more, by C++ applications. Those C++ applications raise an error when used with <code>strlen</code>, for example, forcing us to cast. Lots of casts.</p>
  <p>I would like to remedy that.</p>
  <p>But one thing is extremely important: it must be absolutely compatible without modification and have no impact on the existing projects.</p>
  <p>I thought about making a <code>union</code>. Alas, my variable can't have the same name.</p>
  <pre><code>struct MyStruct {
  
    union {
      unsigned char * myMember;
      // char * myMember; Obvioulsy, rejected by the compiler.
  };
  </code></pre>
  <p>I'm afraid there isn't any obvious solution. Am I wrong?</p>
  <p>I can't change the size of the struct because it's mapped in an unchangeable sized shared memory.</p>