top | item 42939861

(no title)

superlopuh | 1 year ago

My experience with Zig is that it's also a plausible replacement for C++

discuss

order

fuzztester|1 year ago

explanation needed, bro.

nerdy langnoob or noobie langnerd here. not sure which is which, cuz my parsing skills are nearly zilch. ;)

chongli|1 year ago

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

infamouscow|1 year ago

C programmers have long suffered the cumbersome ritual of struct manipulation—resorting to C++ merely to dress up structs as classes.

Zig shatters that with comptime and the 'type' type.

fuzztester|1 year ago

[flagged]