title: fastest way to compare unsigned char* and const char*
body: <p>What is the fastest way to compare unsigned char* and const char* ? </p>
  
  <p>Say, I have</p>
  
  <pre><code>    unsigned char* msg;  //length is more than 10000
      typedef struct {
        atomic&lt;bool&gt; updated;
        const char cmp[10]="test    ";
        int id=10000;
      } test;
  </code></pre>
  
  <p>I want to compare msg ( starting from 30th characters) to test.cmp upto 5 length. I am doing the following code</p>
  
  <pre><code>    for (int k = 0; k &lt; 5; k++) {
              if (*(msg + 30+ k) != test.cmp[k]) {
                  break;
              }
  
      }
  </code></pre>
  
  <p>Is the correct way or do you suggest something else?</p>
  
  <p>Thanks a lot.</p>