News for hackers. Stuff that matters.
Re:Roc rewrites the compiler in Zig by fuzztester on Wednesday February 05, 2025 @01:43AM (#42944770)
>Zig’s comptime feature gives a lot of the power of C++ templates. This makes it easier to implement a lot of libraries which are just a pain to do in plain C. Even seemingly simple things like a generic vector are annoying to do in C, unless you abandon type safety and just start passing pointers to void.

I get it, thanks. in C you have to cast everything to (void *) to do things like a generic vector.

>I believe Zig even has some libraries for doing more exotic things easily, such as converting between an array of structs and a struct of arrays (and back).

yes, iirc, there was a zig thread about this on hn recently.

There are no comments on this comment yet.