title: "Incompatible pointer type" compiler warning for 4th argument of qsort
body: <p>I'm trying to use the standard library's <code>qsort</code> to sort an array of wide characters:</p>
  
  <pre><code>wchar_t a = L'a';
  wchar_t a1 = L'ä';
  wchar_t b = L'z';
  wchar_t chararray[] = {b, a, a1};  
  length = wcslen(chararray);
  
  qsort(chararray, length, sizeof(wchar_t), wcscoll);
  </code></pre>
  
  <p>Now I think the functions involved have these prototypes:</p>
  
  <pre><code>int wcscoll(const wchar_t *ws1, const wchar_t *ws2);
  void qsort(void *base, size_t num, size_t size, int (*comp_func)(const void *, const void *))
  </code></pre>
  
  <p>The results are completely as expected, but why am I getting the compiler warning <strong>"<code>passing argument 4 of ‘qsort’ from incompatible pointer type</code>"</strong>? And how can I cast <code>wcscoll</code> to fit the prototype? </p>
  
  <p>The warning goes away if I define and pass in a separate comparison function:</p>
  
  <pre><code>int widecharcomp(const void *arg1, const void *arg2)
  {
      return wcscoll(arg1, arg2);
  }
  </code></pre>
  
  <p>... but this one looks like it should have error handling for when the arguments are not of type <code>wchar_t *</code>. </p>