News for hackers. Stuff that matters.
Re:Using Zig's translate-C to understand weird C code by kristoff_it on Wednesday November 03, 2021 @08:59AM (#29093962)
This particular example is machine-generated code created by translate-c, it's meant to be semantically equivalent to the C code and even uses language features that you're normally not even supposed to use (c pointers).

Reasonable Zig code looks more like this:

https://github.com/riverwm/river/blob/master/riverctl/main.z...

That said I think it's fine if you don't like the syntax. I think that some complaints are honestly too superficial to be legitimate (like complaining about builtins being prefixed with @), but at the same time Zig is often times prioritizing explicitness over "good looking".

I personally consider Swift a very good looking language, but then I look at all the new features that got added since I used it last, remember that I value simplicity over aesthetics, and go back to Zig.

Re:Using Zig's translate-C to understand weird C code by dragonelite on Wednesday November 03, 2021 @10:02AM (#29094675)
Ooh that looks a bit like Rust having quickly scrolling by. I have been keeping a eye on Zig but I'm waiting till the package manager stuff has been finalized and implemented.