title: How to implement strstr() without casting away const?
body: <p><a href="http://linux.die.net/man/3/strstr"><code>strstr</code></a> is a C99-conforming function, the type signature of which is the following:</p>
  
  <pre><code>char *strstr(const char *haystack, const char *needle);
  </code></pre>
  
  <p>Is it possible to <strong>implement this function</strong> without casting away a <code>const</code> somewhere?</p>
  
  <p>For reference, here is <a href="https://opensource.apple.com/source/xnu/xnu-792.13.8/libsa/strstr.c">Apple's implementation</a>, and here is <a href="http://tsunanet.net/~tsuna/strstr.c.html">GNU's implementation</a>. Both cast away the <code>const</code> at the end.</p>