I am trying to make sense of the following bit of C code.
static unsigned
parent(const struct binheap *bh, unsigned u)
{
(void)bh;
return (u / 2);
}
What could the purpose of (void)bh;
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.
For context, that snippet is from the original implementation of a B-heap. That code tends to be rather too clever in other places as well, e.g. doing for (unsigned n = 2; n; n += n) {
to break at n = 65536.