Re:Why Zig over C for Systems Programming
by drnick1 on Friday November 13, 2026 @11:17AM
(#50485701)
All these new languages are unreadable relative to C. If, like me, you like explicit stuff like for (size_t i = 0; i <= n; i++) total += a[i]; all these new languages won't do it.
[ Parent
| on HN ]
Re:Why Zig over C for Systems Programming
by epolanski on Friday November 13, 2026 @11:20AM
(#50485738)
Anything is less familiar when you come from a certain background.
Study after study has shown that in coding we tend to fall back to conflate simple with familiar.
Re:Why Zig over C for Systems Programming
by nine_k on Friday November 13, 2026 @11:26AM
(#50485830)
I don't like this explicitness, because very often it's a lie. In the times of PDP-11 that would compile into a literal counter and literal MOV and ADD instructions. Now it will most often compile into some vectorized semi-unrolled form with seven-letter instructions that add 4 integers at once, etc.
If I want specific instructions to be run in a specific order, like touching hardware registers, I reach for intrinsics or assembly. If I want an array summed, I prefer to express the intent: total = the_array.sum(); I leave the implementation to the compiler / stdlib.
Re:Why Zig over C for Systems Programming
by tempest_ on Friday November 13, 2026 @12:16PM
(#50486575)
I feel like every time someone tries to tell me how good C is they immediately end up reminding me of https://queue.acm.org/doi/10.1145/3212477.3212479
Re:Why Zig over C for Systems Programming
by raincole on Friday November 13, 2026 @11:42AM
(#50486063)
I honestly don't think total = a.sum() is any less explicit than for (size_t i = 0; i <= n; i++) total += a[i]. If anything, a.sum() is more explicit as at least it expresses the programmer's intention explicitly. The loop is one more layer between the reader and the writer's intention, nor correctly reflecting how it works on the bare metal. So it's the worse of both worlds.
Re:Why Zig over C for Systems Programming
by bmandale on Friday November 13, 2026 @02:27PM
(#50488488)
A toy example is meant to demonstrate a principle. Toy examples often have alternative ways they can be written, but the concept they are meant to demonstrate requires the whole machinery being employed. Furthermore, how do you think .sum is implemented?
Re:Why Zig over C for Systems Programming
by forgotpwd16 on Friday November 13, 2026 @11:57AM
(#50486299)
[delayed]
Re:Why Zig over C for Systems Programming
by zzzoom on Friday November 13, 2026 @01:09PM
(#50487406)
Bad ergonomics in loops is questionable design, but that loop in particular isn't better than total = reduce(a, +, 0).
Re:Why Zig over C for Systems Programming
by bmandale on Friday November 13, 2026 @02:24PM
(#50488459)
> that loop in particular isn't better than total = reduce(a, +, 0).
it is, in fact, better
Re:Why Zig over C for Systems Programming
by shevy-java on Friday November 13, 2026 @01:43PM
(#50487908)
You have a point - I find Rust syntax horrible.
C is in some ways minimal, but the pointer-syntax and some more I absolutely dislike. I also found C++ easier to use in some areas, such as:
cout << "Hey there" << endl;
The equivalent C is simply uglier. Of course C++ failed in other areas big time, but for such simple things like above, I think C++ is better than C. Naturally that cout example is very simplistic, but one can find other examples where C is really quite ugly.
Re:Why Zig over C for Systems Programming
by zelphirkalt on Friday November 13, 2026 @04:21PM
(#50489882)
It's not very readable. The logic is forced to always use often useless counters and check them, even on the syntax level. I will take any for each mechanism over the loop style. Map, reduce, fold, all better than having to write counters and the check for it.