4 ms·
To be fair, K&R (as awesome as it is) also doesn't cover things like epoll or io_uring? And then again, K&R's definitely not a half hour read. Zig's std lib do
by jorangreef 6y ago
To be fair, K&R (as awesome as it is) also doesn't cover things like epoll or io_uring? And then again, K&R's definitely not a half hour read.
Zig's std lib documentation will keep getting better. In the meantime, the std lib code itself is so well written, it's worth a read, even coming from another language, and even if you have no intention to learn Zig. I found it easy to read and was impressed by the code structure and quality of the design.
Of course, that's not to suggest that code is documentation, but I've learned alot about improving my programming in general, just by reading Zig's std lib.
- andi999 6y agoI do not want epoll and io_urig covered in the teaching material. I mean you don't learn a language by reading a dictionary is all I am trying to say.
- daurnimator 6y ago> you don't learn a language by reading a dictionary I love this quote, adding it to my quote list; is it from something?
- andi999 6y agoGlad you like it. I think I just made it up when typing the reply, since the documentation reminded me of a dictionary. But I wouldn't be surprised if this has been said before.
- banachtarski 6y agoepoll and io_uring (the latter of which did not exist when K&R was written) have nothing to do with C though
- pjmlp 6y agoK&R C also doesn't teach how to write code that is actually correct in modern C compilers, nor does it teach C best practices on how to at least try to write safe code in C.
- andi999 6y agoAgree. But it did all this at the time it was published. That's just what I would need for zig. It is OK that this doesn't exist, it just mean one person less picking up the language.
- deleted 6y ago[deleted]
- jorangreef 6y agoYes, that's the point I want to make. Zig the language, and Zig the std lib have two different sets of documentation. The former is really, really good, and I wouldn't say lacking at all, considering Zig is still pre-1.0. Take a look here: https://ziglang.org/documentation/master/ https://ziglang.org/documentation/master/ It's the Zig std lib auto-generated documentation (i.e. I/O things like epoll and io_uring and much more) that is incomplete, and to which most of the "documentation is lacking" and "read the std lib source" comments relate. It's only if you want to know how to use Zig for things like I/O, then you'll need to read the std lib source (and the growing number of blog posts and talks etc), in the same way that K&R is also not always helpful as a guide for these things (and others) today in C. But the Zig language itself is pretty easy to grok from the excellent language documentation and examples already linked to.
- andi999 6y agoFor me it is not easy to grok. Then let me ask you: I need a (large) 3 dimensional array where the size of each dimension is unknown at compile time. What is the zig way to do this, how do I access the elements. Bonus question: I have a function doing a transformation on this array, what is the way to duplicate this array