hashmap.c icon indicating copy to clipboard operation
hashmap.c copied to clipboard

some functions now returning `const void *`

Open scossu opened this issue 7 months ago • 4 comments

I noticed that in https://github.com/tidwall/hashmap.c/commit/84d0d3bf75f297443a5069b801ea13d93ee05e0a#diff-9257c021257b8c2773c58e19016dbd9499f0524100e98dd4616f8a9a55e8b13fR33 return types for hashmap_get, hashmap_set, hashmap_delete, and hashmap_probe were changed to constant. This is raising warnings on code that I have written previously.

Before I change the code on my end, I would like to understand the rationale behind this change. If the intent is to discourage changing the underlying bucket data, I understand the change in hashmap_get and hashmap_probe. For hashmap_set and hashmap_delete, however, I don't see the point in keeping the return values constant, since they are no longer managed by the hashmap. Can you explain? Thanks.

scossu avatar Jul 08 '25 14:07 scossu