logoalt Hacker News

zabzonk12/08/20241 replyview on HN

OK, thank you. But why do the functions have those unused parameters?


Replies

Sesse__12/08/2024

I would assume that is because the hash table takes in a “hash this key” function pointer and a “compare these keys” function pointer, and those must contain the size for variable-length keys. So even if your user-supplied functions know the length, or only care about the first byte, they have to conform to that API, and then you get an unused parameter.

show 1 reply