title: Purpose of casting a struct pointer to void without using the result
body: <p>I am trying to make sense of the following bit of C code.</p>
  
  <pre><code>static unsigned
  parent(const struct binheap *bh, unsigned u)
  {
      (void)bh;
      return (u / 2);
  }
  </code></pre>
  
  <p>What could the purpose of <code>(void)bh;</code> be? It is not assigned to anything and should not have an effect on the output. The only purpose I can think of might be as a kind of an assert against a null pointer perhaps.</p>
  
  <p>For context, that snippet is from <a href="https://github.com/varnish/Varnish-Cache/blob/master/lib/libvarnish/binary_heap.c#L163" rel="nofollow">the original implementation</a> of a <a href="https://en.wikipedia.org/wiki/B-heap" rel="nofollow">B-heap</a>. That code tends to be rather too clever in other places as well, e.g. doing <code>for (unsigned n = 2; n; n += n) {</code> to break at n = 65536.</p>