Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

epoll and io_uring (the latter of which did not exist when K&R was written) have nothing to do with C though


K&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.


Agree. 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.


Yes, 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/

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.


For 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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: