4 ms·
> It should have hash tables at least https://man.openbsd.org/ohash_init.3 https://man.openbsd.org/ohash_init.3
by johnisgood 6y ago
> It should have hash tables at least
https://man.openbsd.org/ohash_init.3 https://man.openbsd.org/ohash_init.3
- ComputerGuru 6y agoWhat of it? > Those functions are completely non-standard and should be avoided in portable programs.
- johnisgood 6y agoSure, it has not been standardized, it is not part of the standard library, so what? Did the world stop? I mean, practically speaking, who cares? Implement it, or find libraries that did. There are plenty. I posted this one because it exists for an OS; OpenBSD, since 1999. Plus, AFAIK ohash is portable enough. It consists of 2 files, and you can compile it with -std=c89. Only the bounded attribute is ignored. If you want I could have brought up hcreate, hdestroy, and hsearch: > The functions hcreate(), hsearch(), and hdestroy() are from SVr4, and are described in POSIX.1-2001 and POSIX.1-2008. Happier?
- ComputerGuru 6y agoI use stb myself, so I have no qualms with that. The point is rather that GP was discussing praise for C’s standard library, and even the most portable single-file include-only dependency remains just that: an external dependency that isn’t part of the C standard library (and no, posix isn’t C).
- johnisgood 6y agoDoes it make much of a difference though? Take the hyped Rust for example. Most useful stuff is in crates, i.e. an external dependency. No one seems to have a problem with that. Personally I do not mind using libraries typically installed by the Linux distribution's package manager anyways. If the question is whether or not I think the C standard library could be improved, then yes, I would say it could, but I do not want it to have a hash table and all sorts of stuff like that, because there are lots and lots of ways to implement them, and they might not suit my needs. C is great, because you can build it from the ground up (if you want to) to make it specifically for your use case. It gives you the building blocks. I believe I have a comment regarding this somewhere, that I like C because it does not implement stuff for you that is in some ways "generalized", which is often a bad thing. This is my problem with "it should have hash tables at least". You cannot implement it in such a way that it suits everyone's needs.
- baby 6y agoRust not having a good standard library is a huge problem. This increases the risk of a rust codebase due to the high number of third party dependencies.
- johnisgood 6y agoI only said that "I do not mind using libraries typically installed by the Linux distribution's package manager", which was in respect to C. As far as Rust goes, yes, I do not like that crates are full of one-liners, and so forth. It shares the same problems that npm has. I ran cargo build on many Rust projects before. No way.