3 ms·
I was really hoping for something more creative than the traditional hashmap approach. Still pretty cool, I wish I was that confident with rolling my own data
by badtension 3y ago
I was really hoping for something more creative than the traditional hashmap approach.
Still pretty cool, I wish I was that confident with rolling my own data structures.
- abhishekjha 3y agoAll you need is a mumrmur hash function to create a hash table. That is something that people should copy.
- tialaramex 3y agoThis (a hash table) is a basic vocabulary type, and it's only barely understandable that C doesn't provide one given when it was invented. The hash table which people are likely to knock together this way in C isn't very good, which makes sense - but if the C library provided one then the effort to do it well only needs to happen once. This isn't like say, Bloom filters where most people don't need one. It's like sort, which I notice C does provide in its standard library.
- camel-cdr 3y ago> but if the C library provided one then the effort to do it well only needs to happen once. It would've happened only once, but in 1987, and then we would've stuck with it, because every body relies on the exact behavior. Just look at `rand()`, it's basically unusable.
- teo_zero 3y ago> Just look at `rand()`, it's basically unusable. It does have some limitations you must be aware of, but "unusable"?
- jandrese 3y agoIt's not technically C stdlib, but POSIX.1 is the next best thing: https://linux.die.net/man/3/hcreate https://linux.die.net/man/3/hcreate That said, the implementation leaves a lot to be desired.