News for hackers. Stuff that matters.
Re:Why Zig over C for Systems Programming by llm_nerd on Friday November 13, 2026 @09:49AM (#50484345)
I wrote recently about a weird issue I encountered with Zig, though to be fair it was related to using Zig to compile C code, humorously in a Rust project (which touches on all of the languages mentioned in this post).

https://dennisforbes.ca/blog/microblog/2026/10/the_accidenta...

While I did just dismiss it as an edge issue, it turns out that this same rather clumsy sort of mistake has happened repeatedly in Zig's pure rewrite of MUSL. And despite being an absolutely catastrophically bad problem, by my judgment, the problem is still in main at this moment, across a wide number of musl function rewrites.

Which gives me pause about the whole zig project. If you're rewriting a critical library, making such simple but consequential mistakes shouldn't happen, and if they do happen it should be a red alert type situation.

Re:Why Zig over C for Systems Programming by dnautics on Friday November 13, 2026 @10:03AM (#50484577)
> Which gives me pause about the whole zig project

The whole zig project is like six people in a trenchcoat. You can't expect them to prioritize your one thing.

Re:Why Zig over C for Systems Programming by llm_nerd on Friday November 13, 2026 @10:07AM (#50484632)
It isn't my thing though. It's quite literally, by choice, their thing. They are the ones who decided that rewriting musl in zig was something they need to do and was such a priority. Only it's a serious regression.

But I mean, the six people in a trenchcoat comment is basically precisely what should give people pause. In my project I simply eliminated zig from the stack entirely because even if I worked around the problems, what comes next? What's the next showstopper that gets waved away as oh well six people in a trenchcoat...

Eh, whatever.

Re:Why Zig over C for Systems Programming by nvme0n1p1 on Friday November 13, 2026 @10:15AM (#50484747)
It's a 0.x project, let them cook. Building things takes time.

https://ziglang.org/documentation/master/std/#std.mem.findSe... didn't exist then, now it does.

And if i may quote from https://ziglang.org/download/0.17.0/release-notes.html:

> Zig has known bugs, miscompilations, and regressions.

> Even with Zig 0.17.x, working on a non-trivial project using Zig may require participating in the development process.

> When Zig reaches 1.0.0, Tier 1 support will gain a bug policy as an additional requirement.

If you're not willing to participate in the development process, then you should wait or use something else.

Re:Why Zig over C for Systems Programming by simonask on Friday November 13, 2026 @10:44AM (#50485186)
Isn't that exactly what they're saying?

Some people (not its creators) talk about Zig as if it's anywhere near production ready. It's fine to be excited about it (there's a lot to be excited about), but we gotta be realistic.

Re:Why Zig over C for Systems Programming by dnautics on Friday November 13, 2026 @10:53AM (#50485328)
No, the framing "give pause" is the soft of framing that people create FUD create
Re:Why Zig over C for Systems Programming by llm_nerd on Friday November 13, 2026 @11:50AM (#50486182)
This whole thread is amazing, and I think people considering Zig should pay close attention.

This submission is advocating Zig over C for system programming. I pointed out a pretty significant reason why maybe you should pause that decision for a bit.

Now it's "FUD", also it's a beta and you're a beta tester, and it's 0.x, and look they disclaim that you shouldn't trust it, and...

This is a bizarre thread. These very comments are precisely why it should give pause (which isn't remotely "FUD", and what an utterly asinine claim). Zig looks neat and it might get there, but this absurd apologism and goalpost moving is not convincing to adopt the language.

Again, in a submission advocating using Zig for system programming. You couldn't script it better.

Re:Why Zig over C for Systems Programming by nvme0n1p1 on Friday November 13, 2026 @10:58AM (#50485424)
Zig team: "Zig is 0.x and has known bugs"

llm_nerd: "I found a bug. This gives me pause about the whole zig project"

I don't see how the latter is a fair reaction given the former. They only just started working on the libc port (although it has been talked about for a while now)

Re:Why Zig over C for Systems Programming by diffxx on Friday November 13, 2026 @10:52AM (#50485314)
They have been cooking for over ten years. It is more than fair to say at this point that they are not capable of shipping a stable, reliable, fast and efficient compiler. It is fundamentally flawed and I could easily write thousands of words explaining why from the architectural design to the development process.

Zig hides behind its pre 1.0 status to justify poor decision making while simultaneously actively trying to attract attention through marketing. That attention translates to resources and influence that are undeserved on the technical merits.

Re:Why Zig over C for Systems Programming by nvme0n1p1 on Friday November 13, 2026 @11:07AM (#50485557)
> I could easily write thousands of words explaining why from the architectural design to the development process.

Alright then go for it, hotshot. We're waiting.

Re:Why Zig over C for Systems Programming by alexrp on Friday November 13, 2026 @01:50PM (#50487993)
> It is fundamentally flawed and I could easily write thousands of words explaining why from the architectural design to the development process.

Always happy to learn.

Re:Why Zig over C for Systems Programming by acedTrex on Friday November 13, 2026 @10:52AM (#50485315)
The dudes name is "llm_nerd" its not worth engaging lol. These are the same people that saw the bun rewrite in rust break tls and fail open and shrugged.
Re:Why Zig over C for Systems Programming by forgotpwd16 on Friday November 13, 2026 @11:29AM (#50485873)
It has been 0.x for 10y+. At this point won't be off if considered 0ver (https://0ver.org) and permanently beta.
Re:Why Zig over C for Systems Programming by MonstraG on Friday November 13, 2026 @10:09AM (#50484665)
I'm not the poster, but I found the related issue:

https://codeberg.org/ziglang/zig/issues/37402

Re:Why Zig over C for Systems Programming by senderista on Friday November 13, 2026 @12:17PM (#50486580)
If their resources are so limited, why have they decided that rewriting libc from scratch is a top priority?
Re:Why Zig over C for Systems Programming by stateoff on Friday November 13, 2026 @10:14AM (#50484741)
Why not adding the link to the issue in the blog post?

https://codeberg.org/ziglang/zig/issues/37402

Looks like it is being worked on.

Personally I think it's not that catastrophic for zig < 1.0. Just a performance regression, and one can always link to other libc implementations, or is their own implementation enforced now?

Re:Why Zig over C for Systems Programming by dleslie on Friday November 13, 2026 @10:17AM (#50484783)
If errors like this are acceptable because of the version number of an otherwise decade old project, then that's ample evidence of why Zig is not ready and should not be used for any software that needs surety.
Re:Why Zig over C for Systems Programming by nvme0n1p1 on Friday November 13, 2026 @10:23AM (#50484873)
When you're setting expectations about a project, it's never a bad idea to listen to the creators themselves.

https://ziglang.org/download/0.17.0/release-notes.html

> Zig has known bugs, miscompilations, and regressions.

> Even with Zig 0.17.x, working on a non-trivial project using Zig may require participating in the development process.

> When Zig reaches 1.0.0, Tier 1 support will gain a bug policy as an additional requirement.

Re:Why Zig over C for Systems Programming by stateoff on Friday November 13, 2026 @10:25AM (#50484925)
https://blog.jetbrains.com/blog/2026/06/05/why-zig-isn-t-1-0...

I did not say it's acceptable, just not catastrophic, especially since workarounds exist.

I've used zig in similar capacity in production in the past and personally I would take the slowdown just to avoid dealing with MSVC :)

Re:Why Zig over C for Systems Programming by Joker_vD on Friday November 13, 2026 @10:27AM (#50484936)
You know that GNU libc to this day essentially calls strlen() on every call to sscanf(), which is pretty much the same issue? And that this behaviour, present in many other implementations of standard C library (including Microsoft's), was responsible for e.g. slow JSON parsing in some very popular online games [0]? Does that mean glibc is still not production-ready?

[0] https://news.ycombinator.com/item?id=26296339

Re:Why Zig over C for Systems Programming by dleslie on Friday November 13, 2026 @10:49AM (#50485258)
sscanf is quadratic in the worst case, and has been flagged along with the rest of the libc string support as being harmful. Its continued existence is for compatibility, but new projects should not use it.
Re:Why Zig over C for Systems Programming by Joker_vD on Friday November 13, 2026 @12:39PM (#50486917)
First of all, sscanf doesn't need to be quadratic in the worst case; it absolutely can work without finding the NUL-terminator first. Second, I'd like to see that list of "flagged along with the bulk of the rest of the libc string support as being hazardous or potentially harmful" functions. Does this list include strchr()? Because if yes, your original argument fails to stand.
Re:Why Zig over C for Systems Programming by Zak on Friday November 13, 2026 @11:57AM (#50486291)
A version number starting with 0 is not just evidence, but a direct statement by the maintainer that software is unstable/pre-release no matter how long it has been in development.
Re:Why Zig over C for Systems Programming by drdexebtjl on Friday November 13, 2026 @10:31AM (#50484994)
[delayed]
Re:Why Zig over C for Systems Programming by senderista on Friday November 13, 2026 @12:15PM (#50486552)
The best kind of correct!
Re:Why Zig over C for Systems Programming by lukaslalinsky on Friday November 13, 2026 @10:59AM (#50485438)
When working with Zig, you are a beta tester. The development process is unfortunately not great, so bugs slip in fairly easily. You need to be ready for it and test your application properly. Large Zig projects don't target the latest version. That said, if you can deal with that, you get a great language that is fun to use and very practical. I think it's worth it, even if it can be frustrating at times.
Re:Why Zig over C for Systems Programming by brabel on Friday November 13, 2026 @12:11PM (#50486507)
I agree Zig can be fun but for real projects people should stick with Rust or even D which is just as fun!
Re:Why Zig over C for Systems Programming by chandlore on Friday November 13, 2026 @11:25AM (#50485818)
Andrew Kelley had a comment re this bug over at lobste.rs:

> I made the judgement call to let this slide in the review. I'm still not sure whether it was the right or wrong call.

https://lobste.rs/s/lh1j0e/shlemiel_painter_is_back_how_zig_...

Re:Why Zig over C for Systems Programming by senderista on Friday November 13, 2026 @12:11PM (#50486502)
Zig can be a hobby/learning project (in which case these elementary mistakes, and the lax development process that allowed them, are totally acceptable), or it can be a project that targets critical applications (like TigerBeetle, which handles REAL MONEY), but it can't be both.
Re:Why Zig over C for Systems Programming by nvme0n1p1 on Friday November 13, 2026 @10:20AM (#50484834)
AI slop. Every article on this site has "The honest tradeoff" as a header. Looks like it was generated to promote a book which is no doubt also just slop.
Re:Why Zig over C for Systems Programming by AlexeyBrin on Friday November 13, 2026 @10:35AM (#50485050)
Let's not exaggerate, it took me 2 seconds to find another recent article from the same website without the "The honest tradeoff".
Re:Why Zig over C for Systems Programming by ibn_khaldun on Friday November 13, 2026 @10:45AM (#50485199)
> Every article on this site has "The honest tradeoff" as a header.

This is a hallucination. I'm sorry. This is what we call these kind of statements these days. Unless you can prove your humanhood, that's how it is now.

Re:Why Zig over C for Systems Programming by raincole on Friday November 13, 2026 @11:03AM (#50485504)
I don't know if this Zig over C article is generated, but the Zig over Rust one [0] is 100% AI.

[0]: https://www.mtsoukalos.eu/2026/04/why-zig-over-rust-for-syst...

Re:Why Zig over C for Systems Programming by hn_submit on Friday November 13, 2026 @12:36PM (#50486850)
How can you tell? I just scanned it but it doesn't feel like being generated.
Re:Why Zig over C for Systems Programming by eatonphil on Friday November 13, 2026 @11:06AM (#50485551)
Re:Why Zig over C for Systems Programming by ivanjermakov on Friday November 13, 2026 @11:12AM (#50485630)
Doesn't read AI generated at all.
Re:Why Zig over C for Systems Programming by ibn_khaldun on Friday November 13, 2026 @11:47AM (#50486134)
The prosody and the headline style is a dead giveaway but compared to other AI generated text this article is far more tolerable.

Meanwhile no one's pointing out any technical errors.

Re:Why Zig over C for Systems Programming by schaefer on Friday November 13, 2026 @01:59PM (#50488123)
Up until about a week ago, I had no sympathy for people complaining about "AI writing style" in articles - and then all of a sudden it hit me. Kind of like unexpectedly developing an allergy to sawdust.
Re:Why Zig over C for Systems Programming by raverbashing on Friday November 13, 2026 @10:30AM (#50484972)
Yeah

The lack of a native slice is the most glaring C fault I think exists

(And of course the committees won't implement it, and of course C is going to remain broken)

Re:Why Zig over C for Systems Programming by brabel on Friday November 13, 2026 @11:19AM (#50485724)
I don’t get it, C arrays can be used as slices, no?? Given a pointer and a length, which is how C does any array, works just as well (I mean if you consider arrays without a length a fine thing) as a slice!
Re:Why Zig over C for Systems Programming by jandrese on Friday November 13, 2026 @01:18PM (#50487525)
Sure you can do that, but you end up having to re-implement all of the standard library functions that expect to work with zero terminated arrays.
Re:Why Zig over C for Systems Programming by uecker on Friday November 13, 2026 @11:21AM (#50485751)
You could help? https://www.open-std.org/jtc1/sc22/wg14/www/contributing.htm...

But I am also quite happy about how far one already gets with variably modified types and a custom span type: https://godbolt.org/z/rPen5Movd

Re:Why Zig over C for Systems Programming by pron on Friday November 13, 2026 @10:35AM (#50485040)
Also, Zig is as at least as expressive as C++ (but without the implicitness and general language complexity that makes reviewing some sensitive code, where you need to see exactly what operations are performed, hard), and it supports arenas better than C/C++/Rust.
Re:Why Zig over C for Systems Programming by coolThingsFirst on Friday November 13, 2026 @10:52AM (#50485291)
show me operator overloading in Zig
Re:Why Zig over C for Systems Programming by nvme0n1p1 on Friday November 13, 2026 @10:58AM (#50485434)
Yes! And exceptions and inheritance and RTTI too. Bring back all the mistakes! Let's party like it's c++99
Re:Why Zig over C for Systems Programming by u8080 on Friday November 13, 2026 @11:05AM (#50485535)
please no
Re:Why Zig over C for Systems Programming by pron on Friday November 13, 2026 @11:07AM (#50485572)
In critical low-level code, any kind of overloading - operator or otherwise - is something you'd rather not have.

By expressivity I don't mean conrecte syntax, but the number of lines needed to express an algorithm (up to a small constant). C doesn't have C++'s expressivity because it lacks templates, and while you can sort of express that kind of thing with macros, it's not all the way there. Zig, however, gets you all the way (you might need to write matrix_plus instead of +, but the expressivity is the same).

Re:Why Zig over C for Systems Programming by Ygg2 on Friday November 13, 2026 @11:26AM (#50485838)
BS. Using operator overloading with SIMD makes it easier to translate algorithms into code. I wrote my own U8x32 wrappers and a + b is way better than a.add(b).
Re:Why Zig over C for Systems Programming by pron on Friday November 13, 2026 @11:53AM (#50486221)
I'm not disputing that some people like operator overloading, but clearly others prefer no overloading of any kind (don't know what the LLMs prefer, if they have any preferences). That's why we need options.
Re:Why Zig over C for Systems Programming by clhodapp on Friday November 13, 2026 @12:32PM (#50486790)
[delayed]
Re:Why Zig over C for Systems Programming by pron on Friday November 13, 2026 @01:12PM (#50487443)
I'm not talking about custom operators. I'm talking about the ability for programs to overload either operators or other symbols (subroutine names). It's true that custom operators don't have to support overloads, but it's hard not to get collisions without overloads.
Re:Why Zig over C for Systems Programming by cornstalks on Friday November 13, 2026 @12:00PM (#50486336)
You can do a+b in Zig with SIMD vectors. No operator overloading required
Re:Why Zig over C for Systems Programming by ogogmad on Friday November 13, 2026 @12:16PM (#50486576)
Sure. But doesn't it still lack autodiff, quaternions, etc?
Re:Why Zig over C for Systems Programming by cornstalks on Friday November 13, 2026 @01:46PM (#50487934)
Yes, there are definitely other use cases that Zig doesn't support (which some may view as a good or bad thing). I just wanted to respond to the comment about basic SIMD since the example was U8x32 and operator+, which Zig can do.
Re:Why Zig over C for Systems Programming by Ygg2 on Friday November 13, 2026 @02:22PM (#50488441)
Point wasn't about SIMD, but defining my wrapper for it and giving it operations I needed.

Which seems to be something Zig can't do.

Hell, you can define operators for generic length SIMD lane.

Re:Why Zig over C for Systems Programming by Ygg2 on Friday November 13, 2026 @01:55PM (#50488061)
Same goes for any bitwise operation <<, >>, &, |, %.

Can I write my SIMD/number abstraction and have it work?

Let's say I need rotors. With six dimensions. Can I overload it's basic numeric operations?

Re:Why Zig over C for Systems Programming by bunderbunder on Friday November 13, 2026 @12:22PM (#50486653)
The example you choose is rather telling, though. It indicates that the use case you have in mind is not at all the one that Zig is targeting.

A more humble critique would be to just acknowledge that you don’t seem to be a member of Zig’s target audience, and move on.

Re:Why Zig over C for Systems Programming by Ygg2 on Friday November 13, 2026 @02:00PM (#50488134)
I am in the target audience. I do want low level systems programming.

Saying "you don't want operator overloading" in such cases is a reductionist view of how systems programming should look.

Re:Why Zig over C for Systems Programming by hitekker on Friday November 13, 2026 @03:55PM (#50489525)
To be fair, the impression is that you want to do low level systems programming in Rust. It's a fine preference but it does put you in a different audience
Re:Why Zig over C for Systems Programming by tialaramex on Friday November 13, 2026 @12:27PM (#50486716)
C++ destroyed the good will here by simultaneously insisting that you're only supposed to use this feature to give types their natural operators (makes sense) and then inventing implausible new "natural" operators so that Bjarne can show off his new toy with the I/O streams.

I actually don't like Rust's choice to implement + for Strings but most people seem to accept that, however C++ goes ludicrously far beyond "I don't like it but some people do" and straight off the cliff into "Nobody thinks that's OK" leaving you to wonder why there was effort to implement this bad idea. For example C++ can overload the short-circuiting boolean operators... but the overloaded versions don't short circuit. So now you've made things dramatically worse!

Re:Why Zig over C for Systems Programming by pron on Friday November 13, 2026 @01:20PM (#50487542)
Note that it's not that Zig is opposed to (user-controlled) operator overloading; it's opposed to (user-controlled) overloading of all symbols: The resolution of `foo` in `foo(x)` should not depend on the type of `x`. The issue is not the operators but the overloading, and Zig wants to prevent (user-controlled) overloading of any kind. This makes some things less convenient and other things more convenient.
Re:Why Zig over C for Systems Programming by tialaramex on Friday November 13, 2026 @03:13PM (#50489004)
> The resolution of `foo` in `foo(x)` should not depend on the type of `x`

This depends on how you're squinting at this word "resolution".

Remember on a modern CPU an XOR R1 R1 does not result in an ALU operation, the decoder understands this idiom and just renames a zero'd register as R1, whereas of course it can't do that for say XOR R2 R3 because that's an actual XOR operation. So if "resolution" means "exactly what happens on the CPU" apparently there is no such facility provided even in assembler.

So apparently we mean only that it should have, in some sense, the same effect. I think the fact Rust is OK with

  assert!("Goose".contains('o'))
  assert!("Goose".contains("Goo"))
  assert!("Goose".contains(&['a', 'e', 'i', 'o', 'u']))
.. meets this criterion, whereas presumably you do not agree.
Re:Why Zig over C for Systems Programming by pron on Friday November 13, 2026 @03:24PM (#50489133)
It's not about okay or not okay. Zig is designed to prevent any user code from being implicitly called, or for the resolution of user code to be done implicitly. It's not about what the CPU does internally, but whether you're able to tell, from reading the code of a single subroutine, which operations could be done, whether stack frames can be created etc.. This has pros and cons, and for some people the pros outweigh the cons and for others, the other way around, and that's why different programming languages need to prioritise different things when they target different users.
Re:Why Zig over C for Systems Programming by melodyogonna on Friday November 13, 2026 @11:11AM (#50485616)
Many people are against operator overloading, imo my only issue with C++ operator overloading is that you're allowed to overload the the assignment operator. From what I can see this is the root of many issues
Re:Why Zig over C for Systems Programming by vnorilo on Friday November 13, 2026 @12:22PM (#50486648)
overloading the comma is also a special flavor. everyone should try it once.
Re:Why Zig over C for Systems Programming by bunderbunder on Friday November 13, 2026 @12:43PM (#50487009)
I’ve also experienced some unnecessary shenanigans related to blurring the distinction between primitive operations, and stuff that happens dynamically at run time such as method calls.

For a somewhat different example of the same general idea, look at how Java handles primitives and their boxed counterparts. = on two ints always compares their value. = on two Integers compares their pointers. But it uses flyweight instances for values up to 256, so in Java, whether two Integers with the same numeric value are equal according to the = operator depends on what that value is.

Then throw autoboxing and generics into the mix, and it suddenly becomes very easy to do refactorings that work fine in the unit tests (which tend to use small numbers) but fails in confusing ways in production.

This isn’t an example of operator overloading, of course. But I hope it more simply illustrates why, at least in certain problem domains, there’s value in being able to visually tell when surprising runtime shenanigans are and are not possible. And also to make it impossible to cross that boundary without touching all code that falls within the blast radius of that change.

Re:Why Zig over C for Systems Programming by wpollock on Friday November 13, 2026 @01:25PM (#50487640)
> But it uses flyweight instances for values up to 256, so in Java, whether two Integers with the same numeric value are equal according to the = operator depends on what that value is. ...

I believe Java caches Integer objects for values -128..+128, not 256. But that may be an implementation detail, and not something to count on.

Re:Why Zig over C for Systems Programming by gf000 on Friday November 13, 2026 @01:34PM (#50487779)
And since java 28's value types, == will work identically for all Integers, finally.
Re:Why Zig over C for Systems Programming by wpollock on Friday November 13, 2026 @03:08PM (#50488943)
[delayed]
Re:Why Zig over C for Systems Programming by bunderbunder on Friday November 13, 2026 @01:43PM (#50487894)
No, you’re right. I misremembered.
Re:Why Zig over C for Systems Programming by wpollock on Friday November 13, 2026 @02:59PM (#50488846)
> No, you’re right. I misremembered.

We both misremembered. I found where this is documented and the range is -128..127 inclusive: <https://docs.oracle.com/en/java/javase/27/docs/api/java.base...>

Re:Why Zig over C for Systems Programming by ogogmad on Friday November 13, 2026 @11:54AM (#50486227)
Is there a way to support varying the meaning of "+" etc without introducing a lot of complexity? I suppose if Zig had nested functions, and the ability to define a nested function called "+", then you would have name shadowing instead of "overloading".
Re:Why Zig over C for Systems Programming by positive-spite on Friday November 13, 2026 @10:53AM (#50485337)
To anyone interested in arena allocators.

Rust just stabilized its `Allocator` API in version 1.100.0. Definitely worth checking out!

Re:Why Zig over C for Systems Programming by Bigpet on Friday November 13, 2026 @11:09AM (#50485589)
Seems like a long way to walk though. Retrofitting this will take time (if it'll ever complete). Zig made it a core part of the language and library. I'll assume Rust will make it farther than C++ ever made it, but just take a look at how retrofitting custom allocators is going there.

Seems like it will be useful for use-cases like embedded where you're restricted to certain parts of the library anyway. But the battle is kind of already lost for support at the level of Zig or Odin. Even if they retrofitted support for the whole standard library, they'll never be able retrofit all crates or make people even bother adding support for all new crates.

Re:Why Zig over C for Systems Programming by treyd on Friday November 13, 2026 @11:29AM (#50485869)
Rust's Allocator APIs have been around since 2016, less than a year after 1.0, they're just now stabilized.

The stdlib types that allocate have been generic (with default generic parameters) over the underlying Allocator used for a very long time. All widely-used data structure libraries where it's feasible/reasonable to use other allocators also are already generic over the Allocator.

It won't "take time to retrofit" because the language and ecosystem have already been prepared for it for 10 years. For context, async syntax was introduced a few years after that and if you just started learning the language today you wouldn't notice it wasn't there in 1.0.

Re:Why Zig over C for Systems Programming by Bigpet on Friday November 13, 2026 @11:46AM (#50486119)
Seems like I've misread the recent Rust version announcement:

> This release brings about the stabilization of the core parts of allocator_api, enabling library authors to define custom allocators that can be used together with certain standard library types - currently Vec and Box. These are enabled through the newly-stabilized Allocator trait.

That made it sound like it was rather limited currently.

I asked an LLM (because it's outside my expertise) and it said:

> It is fair to say that the heaviest architectural lifting is already done: adding a defaulted type parameter (A: Allocator = Global) preserves backward compatibility for existing code, and the core data structures already store and thread the allocator internally. However, plumbing that generic parameter through String, HashMap's std wrapper, and hundreds of standard library methods still represents substantial retrofitting work rather than a completed state.

Looks like The patch notes lead me a bit astray. But it's also not at an 'already all there' state either.

Re:Why Zig over C for Systems Programming by tialaramex on Friday November 13, 2026 @12:22PM (#50486647)
Although it's true that all of Rust's standard library collections are generic over Allocator, Rust 1.100 only stabilizes useful allocator APIs for Box and Vec

If you want to use your MyCustomAllocator with a HashMap or a BinaryHeap or you've lost your mind and want a LinkedList none of that was stabilized yet.

Personally I am slightly interested in HashMap, VecDeque and String but I think Vec is much more heavily used than any of those and will illustrate just how thin the pickings are in this space for real.

Re:Why Zig over C for Systems Programming by atiedebee on Friday November 13, 2026 @02:43PM (#50488681)
Perhaps custom allocators could be interesting for BTreeMap and BTreeSet? I am not familiar with their internal implementation, but as I understand it those should allocate fixed-size blocks, which would benefit from a specialized fixed-size allocator.
Re:Why Zig over C for Systems Programming by tialaramex on Friday November 13, 2026 @12:15PM (#50486565)
> Seems like it will be useful for use-cases like embedded where you're restricted to certain parts of the library anyway. But the battle is kind of already lost for support at the level of Zig or Odin.

Odin in particular does a simply terrible job here. Take the most common need for allocations, a growable array type, in Rust Vec<T> and in Odin dynamic[T]

In Rust we only pay extra to store the allocator metadata if there is allocator metadata. If we're content using the general purpose allocator Global with global metadata it's free. In Odin we always need to pay to store an "allocator proc" function pointer and a (possibly unused) metadata pointer, so that's 2x machine word worse for Odin. We pay this even if we never allocate, and indeed even if we can't allocate, whereas of course in Rust that's free.

But then when we do need to allocate, in Rust that's a static dispatch unless our allocator specifically wants dynamic dispatch. So again for Global it's just a static dispatch. But in Odin it's always a slower dynamic dispatch.

The upside? To the extent there is one it's probably the New Jersey style, ie it was simpler to implement Odin. Which is a benefit to Ginger Bill, but not to you as an Odin programmer.

Re:Why Zig over C for Systems Programming by Bigpet on Friday November 13, 2026 @03:18PM (#50489062)
Sounds like the Odin implementation isn't particularly optimal. My point wasn't about speed or good implementations. My point was about which languages make it practical to consistenly use custom allocators as a user of the language. Not just across your own code, but also code from the standard library and external packages.

I have no practical Odin experience, I just looked at the core concepts. I tried a bit of Zig and there's significant discipline in the standard library to enable allocator use. But in 3rd Party libraries this discipline is hard to enforce because it also makes it harder to design easy to use interfaces.

I'm interested where on the spectrum of allocator usability Rust will end up at. I'd expect it somewhere between Zig and C++

Re:Why Zig over C for Systems Programming by program on Friday November 13, 2026 @10:47AM (#50485229)
> Errors you cannot ignore

It's okay for me to declare a macro with `__attribute__((warn_unused_result))` for GCC and Clang, and `[[nodiscard]]` when the C code is later compiled with C++ (or nothing).

Re:Why Zig over C for Systems Programming by uecker on Friday November 13, 2026 @12:11PM (#50486496)
[[nodiscard]] is in C23.
Re:Why Zig over C for Systems Programming by mogoh on Friday November 13, 2026 @10:50AM (#50485271)
Is Zig stable yet? No.
Re:Why Zig over C for Systems Programming by ginko on Friday November 13, 2026 @10:52AM (#50485317)
I like Zig but having to fix a bunch of version issues each time I touch an old zig project of mine really put a damper on my enthusiasm.
Re:Why Zig over C for Systems Programming by mi_lk on Friday November 13, 2026 @11:11AM (#50485625)
to save your enthusiasm, tell your clanker to fix version issues instead
Re:Why Zig over C for Systems Programming by dralley on Friday November 13, 2026 @12:08PM (#50486458)
Heretic! Exile the clanker enthusiast for heresey!
Re:Why Zig over C for Systems Programming by ACCount39 on Friday November 13, 2026 @11:49AM (#50486161)
I like the idea of Zig too - "better C" sounds just up my valley - but the actual implementation leaves a lot to be desired.
Re:Why Zig over C for Systems Programming by senderista on Friday November 13, 2026 @11:51AM (#50486191)
Nor is its creator.
Re:Why Zig over C for Systems Programming by kombine on Friday November 13, 2026 @11:04AM (#50485511)
D and Nim have had the same features for years btw.
Re:Why Zig over C for Systems Programming by tcoff91 on Friday November 13, 2026 @11:13AM (#50485641)
God I loved playing around with D back in the day when I was in high school. It seemed like a no-brainer that it was going to be huge. It's such a shame it never took off. Incredible language.
Re:Why Zig over C for Systems Programming by giancarlostoro on Friday November 13, 2026 @11:25AM (#50485819)
It's so damn nice, its a shame it's never taken off the way it could. I think there's still time to make it attractive to companies, but with people's increasing use of AI I don't think anyone even cares what language their model writes in, look at the insane uptick in Rust programming.
Re:Why Zig over C for Systems Programming by vips7L on Friday November 13, 2026 @11:39AM (#50486028)
I try D almost every year, but I've never really gotten a working IDE environment with it. I'm not sure if it's issues with being on Windows or just the LSP not being that great. I really wish D was adopted as widely as Go.
Re:Why Zig over C for Systems Programming by giancarlostoro on Friday November 13, 2026 @11:43AM (#50486076)
Which IDE are you trying to setup with D? I've not had any issues... You may try DlangIDE possibly?

https://github.com/buggins/dlangide

Re:Why Zig over C for Systems Programming by vips7L on Friday November 13, 2026 @01:53PM (#50488030)
I've tried the intellij plugin and vscode extension. It never seems to work right. I remember there being lots of issues about not finding phobos/the standard library.
Re:Why Zig over C for Systems Programming by giancarlostoro on Friday November 13, 2026 @11:24AM (#50485796)
I like both of those, I like the idea of Zig, it does seem to be striving to be pure in some areas where C is "king" that other languages gloss over, but Zig is always changing, and its got some elitist people in its ranks that left me not wanting to bother with it. Imagine a programming language maintained and used by geohot clones.
Re:Why Zig over C for Systems Programming by sergiotapia on Friday November 13, 2026 @11:34AM (#50485941)
https://github.com/nim-lang/nimony

Check out Nimony effectively Nim 3.0 from the author. It's a top to bottom rethinking of Nim with all the lessons learned. I'm so hyped about it tbh

https://nim-lang.org/araq/nimony.html

Re:Why Zig over C for Systems Programming by Fervicus on Friday November 13, 2026 @02:03PM (#50488185)
Intriguing. How usable is it right now?
Re:Why Zig over C for Systems Programming by seanw444 on Friday November 13, 2026 @02:16PM (#50488362)
If they can get the tooling situation handled better with 3.0, Nim will be probably the best all-around programming language in my book. The only reason I tend to opt for Zig instead (and the reason the library ecosystem is pretty small) is that it just feels a little unpolished all over the place. But the core principles are just so good.

I don't mean that as an insult to Zig. Zig is amazing. But the ergonomics of Nim are just unbeatable.

Re:Why Zig over C for Systems Programming by bowsamic on Friday November 13, 2026 @11:57AM (#50486282)
It’s pretty obvious why they didn’t, they’re GC by default. That’s already enough to put people off, even if it’s “not a problem” in reality, people will just avoid it for systems programming if they hear that, they will assume all the good features need the GC
Re:Why Zig over C for Systems Programming by arc619 on Friday November 13, 2026 @01:03PM (#50487312)
Nim is stack allocated by default, and you annotate types explicitly with `ref` to use the GC. Even then, the compiler elides reference counting using borrow checks, you can choose different GC options, and the GC isn't stop the world like most. You don't need to touch reference counting if you don't want to, and Nim fits embedded dev pretty well for that reason.
Re:Why Zig over C for Systems Programming by bowsamic on Friday November 13, 2026 @01:54PM (#50488042)
GC was the default in the earlier versions of Nim and ARC is still default today. That’s why people ignore it
Re:Why Zig over C for Systems Programming by bmandale on Friday November 13, 2026 @02:27PM (#50488499)
Many GCed languages have any number of useful features. But when the discussion is focused on systems programming, they are quite off topic.
Re:Why Zig over C for Systems Programming by fithisux on Friday November 13, 2026 @11:09AM (#50485594)
C is far behind the sate-of-art in C and Go families. True, but not bad.

It is what it is, but can work on what it already has, while keeping its tradition. Small changes, add common extensions, conservative additions, improve coherence and correctness of the standard while keeping easy to implement and small.

No crazy things.

Re:Why Zig over C for Systems Programming by uecker on Friday November 13, 2026 @11:17AM (#50485693)
Zig is a nice language, but those articles always compare new languages against old-style C without use of modern tools. Most of the listed advantages you can have in C as well if you are willing to adopt modern tooling and style: signed overflow checking: sanitizers, errors you can not ignore: [[nodiscard]], slice type which know their size: variably-modified types or span types.

Defer will also appear in C compilers soon, but personally I still think goto-error handling is clearer.

(Rust has an advantage for temporal memory safety, but this does apply to Zig.)

Re:Why Zig over C for Systems Programming by bunderbunder on Friday November 13, 2026 @11:32AM (#50485924)
It seems that part of what Zig is trying to do, though, is create a pit of success around these practices. So the response might be something like, “Yes you can do these things in modern C, but doing it consistently requires more discipline than we’d like.”

https://blog.codinghorror.com/falling-into-the-pit-of-succes...

Re:Why Zig over C for Systems Programming by uecker on Friday November 13, 2026 @12:09PM (#50486469)
I do not think it needs a lot of discipline. It needs the willingness to do it, but this is also true for adopting a different language.
Re:Why Zig over C for Systems Programming by ProphetOfParado on Friday November 13, 2026 @12:26PM (#50486697)
Yes sir, with the right kind of discipline even assembly starts to look like luxury. With a heart that holds no fear, one can code in straight 0's and 1's.\s

These days I wonder what is harder: 1. problems of collective action or 2. communicating that reducing everything to collective action is the real issue.

Re:Why Zig over C for Systems Programming by yawpitch on Friday November 13, 2026 @12:40PM (#50486936)
If your heart holds no fear then shouldn’t that read 01 or 10?
Re:Why Zig over C for Systems Programming by markatto on Friday November 13, 2026 @02:21PM (#50488424)
My heart holds fear of unintentional octal
Re:Why Zig over C for Systems Programming by bioneuralnet on Friday November 13, 2026 @02:26PM (#50488480)
One or sixteen?
Re:Why Zig over C for Systems Programming by uecker on Friday November 13, 2026 @02:40PM (#50488661)
Now explain why the collective action problem of moving everybody to Zig is easier than the collective action problem of improving C usage and tooling. IMHO the latter is far more realistic (and in fact a lot has already improved).
Re:Why Zig over C for Systems Programming by bunderbunder on Friday November 13, 2026 @03:46PM (#50489405)
So, suppose a team - so hopefully a rather small instance of "everybody" - has decided to make some changes to how they work, and they're trying to decide between adopting Zig and changing their existing C coding conventions.

Suppose, also, that they have decided to make the change incrementally. So a rewrite is not in the cards.

The advantage of sticking with C that I see is that nobody has to learn a new language, migrate to a new toolchain, anything like that. So it is definitely the smaller change. But the downside is that it may be more difficult to hold the line. For some indeterminate (possibly indefinite) period of time you have a mix of legacy code that's being allowed to stay on the old conventions, and new/migrated code that's supposed to be held to the new conventions. IME one solo developer can maintain that distinction, but a team working in a business environment, possibly with people cycling on and off, will struggle with it. You can try to bake the distinction into your tooling, but that's often easier said than done. Most tools expect one set of conventions per project.

The advantage of adopting Zig that I see is that you set a clear demarcation line. New files will be written in Zig. Migrated code gets ported to Zig. Everyone knows that Zig has one coding standard, C has another coding standard. They look different, so it's easy to keep track of which is which. They each have their own compiler flags and static analysis tools, so it's hopefully easier to separate the legacy rules from the new ones.

Now, I mostly do cruddy business applications so I haven't actually done this with C and Zig. But I have done it on the JVM, and IME whether "modernize legacy Java in place" or "modernize legacy Java by strangler vining over to Kotlin" works better depends heavily on what the legacy code in question actually looks like and how much you want to change.

Re:Why Zig over C for Systems Programming by slopinthebag on Friday November 13, 2026 @01:10PM (#50487418)
might as well use rust and fall into a much wider and deeper pit of success
Re:Why Zig over C for Systems Programming by sergio-gdr on Friday November 13, 2026 @11:33AM (#50485934)
comptime instead of preprocessor macros is pretty big though…
Re:Why Zig over C for Systems Programming by William_BB on Friday November 13, 2026 @11:48AM (#50486153)
IMO you cannot fairly compare static analyzers/sanitizers with features baked into the language/compiler.

Though I've noticed the same trend when reading a famous Rust primer for C++ developers. Like there are obviously so many good and valid arguments when comparing the two languages that would've gotten the point across. Yet the authors felt the need to push it one step further, where the comparison no longer seems fair. Like comparing Rust with C++17 when C++20 provides the same exact feature that Rust claims to provide.

Re:Why Zig over C for Systems Programming by 0c3ca83 on Friday November 13, 2026 @12:03PM (#50486373)
Where do you think the static analyzers are baked into for C?

    gcc -fanalyze ...
    clang -fsanitize=address ...
    etc
Re:Why Zig over C for Systems Programming by logicchains on Friday November 13, 2026 @12:25PM (#50486687)
Those aren't static analyzers, they're dynamic analyzers; they only catch issues at runtime.
Re:Why Zig over C for Systems Programming by 0c3ca83 on Friday November 13, 2026 @12:38PM (#50486895)
GCC's -fanalyze, and clang's `--analyze` both run static analyzers.
Re:Why Zig over C for Systems Programming by metaltyphoon on Friday November 13, 2026 @12:42PM (#50486983)
If this is such a good default, why make me type `-fsanatize=address? Why isn't this the default when not doing "release mode"?
Re:Why Zig over C for Systems Programming by woodruffw on Friday November 13, 2026 @12:53PM (#50487150)
It adds nontrivial runtime cost. It’s also not a perfect mitigation (there are plenty of unsound patterns that ASan, UBSan, and TSan won’t catch).
Re:Why Zig over C for Systems Programming by William_BB on Friday November 13, 2026 @12:55PM (#50487183)
The obvious answer is that I don't want to pay for these checks at runtime and can catch most of these bugs at test time. There are definitely use cases where that's acceptable.
Re:Why Zig over C for Systems Programming by William_BB on Friday November 13, 2026 @12:45PM (#50487029)
I meant static analyzers like clang-tidy and cppcheck. `-fanalyze` I suppose is a fair comparison, but `fsanitize` is not since it's not even static
Re:Why Zig over C for Systems Programming by dnautics on Friday November 13, 2026 @12:49PM (#50487080)
I'm very certain you can statically analyze zig's IR. And zig makes it easier to get consistency because you are steered away from the mishmash of malloc/jemalloc/pick-your-allocator-function. (The analyzer can say "all bets are off if you don't use the allocator interface") same with the new stdlib io interface for async-shaped analysis on aliasing analysis

github.com/ityonemo/clr

Re:Why Zig over C for Systems Programming by erikpukinskis on Friday November 13, 2026 @12:06PM (#50486424)
That works as long as you have zero dependencies.

As soon as you have dependencies you are dealing with however the authors decided to build things.

Part of why languages exist is just to get a new ecosystem.

At this point, you could fork C/C++, only remove features, give it a new name, a new package service, and maybe fork the standard library, and you could end up with something pretty competitive against Zig or Rust.

Re:Why Zig over C for Systems Programming by bunderbunder on Friday November 13, 2026 @12:12PM (#50486510)
But Zig is expressly not trying to bootstrap a completely new ecosystem. Integrating with - and depending on - existing C and C++ code is a core use case. So much so that they’ve adopted “maintain it with Zig” as a motto that intentionally puns on “rewrite it in Rust”.
Re:Why Zig over C for Systems Programming by uecker on Friday November 13, 2026 @12:15PM (#50486564)
I don't see why this requires not having dependencies.

Yes, new languages try to create a new ecosystem. I think this is a bad thing - we already have too many of such - often somewhat isolated - language ecosystems. But I also do not think we need new ecosystems, when we can evolve the existing one. I have seen C evolve quite a bit over time, so the idea that we have to create new ecosystems to solve problems is wrong in my opinion. C evolves very slowly, which means that some things need more time, but I also think that it is generally a very good thing that it evolves slowly.

Re:Why Zig over C for Systems Programming by metaltyphoon on Friday November 13, 2026 @12:44PM (#50487022)
> I also think that it is generally a very good thing that it evolves slowly

This is why new ecosystems starts. Not everyone is ok with the slow pace

Re:Why Zig over C for Systems Programming by uecker on Friday November 13, 2026 @02:47PM (#50488732)
Not being happy with the speed is something I can understood.

But I think a fair comparison of new languages to C has to take modern C features and tooling into account.

Re:Why Zig over C for Systems Programming by simjnd on Friday November 13, 2026 @12:21PM (#50486635)
Zig's tooling is very good, so is the cross-compatibility story and tagged unions.

But while you can have some/most of the benefits Zig has from modern C, I think an underrated benefit is the language culture. As a different language it was the opportunity for a reset, e.g. it's idiomatic Zig to pass allocators to functions, meaning every library in Zig will work this way.

You could do that in C, but none or very few libraries do that so whenever you reach out to third-party dependencies (which is not a lot, in C as in Zig) you have to fight against C's traditional patterns.

Re:Why Zig over C for Systems Programming by znpy on Friday November 13, 2026 @12:24PM (#50486676)
I mostly agree, but as usual there are the classical catches:

1. yeah you can do that, but we should really do some (most? all?) of the things you mention (as well as other safeguards) mandatory

2. your code might be alright, but what about your dependencies ?

Re:Why Zig over C for Systems Programming by skohan on Friday November 13, 2026 @12:48PM (#50487076)
There's a big difference between opt-in and opt-out features.
Re:Why Zig over C for Systems Programming by pjmlp on Friday November 13, 2026 @01:08PM (#50487384)
Because some of those tools exist since 1979, and it keeps being a quixotic battle to make corporations adopt them as standard, until cybersecurity legislation started to take off.
Re:Why Zig over C for Systems Programming by uecker on Friday November 13, 2026 @02:53PM (#50488777)
I think this is indeed the main problem. But it would also be the proper solution. For some the "in C/C++ this can not be fixed" narrative is a convenient excuse not to improve their code. Those parties will also not rewrite in Rust, because even with AI this more effort than zero, and zero effort is what they aim for. (and some of those parties are represented in standardization committees and vote against stricter requirements)
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.
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.
Re:Why Zig over C for Systems Programming by pipeline_peak on Friday November 13, 2026 @11:22AM (#50485770)
Zig will never be successful.
Re:Why Zig over C for Systems Programming by jftuga on Friday November 13, 2026 @11:33AM (#50485927)
Why so?
Re:Why Zig over C for Systems Programming by Numerlor on Friday November 13, 2026 @11:42AM (#50486065)
Their rewrites of all security critical libraries while also refusing to use AI which at the moment is surfacing huge vulnerabilities all over the place.

And of course it needs to get to stable first

Re:Why Zig over C for Systems Programming by variadix on Friday November 13, 2026 @11:24AM (#50485795)
I’ve settled on a dialect of C++ for systems programming after using C for a long time. It’s mostly C-like and I disable exceptions, RTTI, etc. but I do use templates, overloads, methods, lambdas, etc.

I have my own object system with constructor methods that all return a status code so you don’t need exceptions, my own stdlib for containers, buffered I/O, networking, hashing, math, threading, async, etc.

C++ gives you all the features to effectively build your own language, and you can use first class tooling since C++ is widely supported. LLMs also make it much easier to build out and test an entire stdlib on your own.

Re:Why Zig over C for Systems Programming by jandrewrogers on Friday November 13, 2026 @12:07PM (#50486434)
I've essentially done much the same. One of the more under-rated features of C++ is being able to build a new language environment based on a different set of composable idioms from the low-level primitives on up.

C++ is as much a tool for building nice systems DSLs as it is a systems language. The heavy investment in compile-time expressiveness has really paid off for the language over time.

Re:Why Zig over C for Systems Programming by jimbob45 on Friday November 13, 2026 @12:10PM (#50486490)
What are you using for a build system?
Re:Why Zig over C for Systems Programming by faresahmed on Friday November 13, 2026 @12:29PM (#50486737)
Agreed. I'd not ditch the STL completely, but only use its freestanding subset. Implementations contain some very fast SIMD-accelerated code[1]. +The STL works without exceptions.

[1]: https://github.com/microsoft/STL/blob/main/stl/src/vector_al...

Re:Why Zig over C for Systems Programming by pjmlp on Friday November 13, 2026 @01:11PM (#50487426)
This is the way, take what suits your use case, using C++ doesn't mean taking the whole feature list.
Re:Why Zig over C for Systems Programming by bbkane on Friday November 13, 2026 @01:19PM (#50487531)
And don't work with anybody who has a different favorite subset of C++!
Re:Why Zig over C for Systems Programming by pjmlp on Friday November 13, 2026 @02:15PM (#50488347)
Well, that is what coding style guides are for, machine enforced. :)
Re:Why Zig over C for Systems Programming by lilbigdoot on Friday November 13, 2026 @02:39PM (#50488642)
I'm imagining a humanoid hitting me with a spray bottle like a cat every time I break the style in code review
Re:Why Zig over C for Systems Programming by lilbigdoot on Friday November 13, 2026 @02:37PM (#50488620)
I don't write much C or C++, but I like writing transpilers and got pretty far with an F# to C backend a while ago, and it was pretty difficult for me (granted it was my first codegen project)

I tried it again with C++ out of curiosity and C++ is ridiculously featured for making it into your own and little domain languages or something that feels like a new feature. Genuinely kind of awesome for transpilers and it definitely gave some insight to the "C++ is awesome, but you have to pick the 20% of features you like" wisdom I've heard

LLMs were fun for exploring C++ patterns as well. I could ask it techniques for approximating some construct in another language and get a full page of toys to try out. It definitely made me want to explore templates in my own language in addition to runtime generics

Re:Why Zig over C for Systems Programming by adsharma on Friday November 13, 2026 @02:46PM (#50488710)
The reason why I prefer a GC based compiled language with types vs Rust or Zig is that they put memory allocation front end center in the language.

Sometimes I want to think about algorithms and memory management separately.

  scores = {"alice": 100, "bob": 85}
  scores["charlie"] = 92
Try translating to zig.

This is why we need natural language -> pseudo code -> GC typed -> Low level systems.

Both Zig and Rust are fine as the last stage of this software development pipeline with different trade-offs. Problems arise when people try to use them earlier in the process.

Re:Why Zig over C for Systems Programming by qweqwe14 on Friday November 13, 2026 @11:32AM (#50485909)
Rust will take over all these niche languages anyway. Yes, Rust is a viable replacement for C and C++ in the long term. Zig is just trying to be a middle ground, which we've established doesn't work. Zig is particularly irrelevant compared to Rust in the LLM era.
Re:Why Zig over C for Systems Programming by lossolo on Friday November 13, 2026 @01:16PM (#50487492)
> Zig is particularly irrelevant compared to Rust in the LLM era.

This. If we continue on this LLM/AI trajectory, and you're not constrained by your platform to use a specific language, why would you choose C or Zig or C++ over Rust? You won't be reading or writing the code yourself, LLMs will, and they benefit from a strong type system that catches a lot of issues, meaning fewer tests are needed.

Re:Why Zig over C for Systems Programming by nickmonad on Friday November 13, 2026 @01:23PM (#50487601)
Why can’t the LLMs avoid the memory issues entirely?
Re:Why Zig over C for Systems Programming by gf000 on Friday November 13, 2026 @01:44PM (#50487919)
In the general case, there can be cases where it's simply straight up undecidable. (Think of a while loop going for as long as it finds a counterexample to insert your unsolved math problem of your choice) and call a free after. Sure, it's a very contrived example but similar "basically impenetrable barriers" do happen.

But the more common case is simply that each line of code gets some limited "thinking", whether it's inside the model's weights, a thinking block, or a whole turn. Only repeated turns can reason for arbitrary depths, so it's just not necessarily a good use of any of these buckets to spend on something we have a good and efficient algorithm for. Plus any of the former are stochastic which may accidentally ignore true issues (just like humans).

Re:Why Zig over C for Systems Programming by 14113 on Friday November 13, 2026 @03:30PM (#50489207)
Because LLMs are statistical. They can, with a given probability, avoid memory issues, but cannot prove the non-existance of memory issues in the way that that borrow checkers and other formal methods can.
Re:Why Zig over C for Systems Programming by mglvsky on Friday November 13, 2026 @01:24PM (#50487615)
Are all programming languages which initially to be ergonomic to humans (Rust included) irrelevant in the "LLM era"?
Re:Why Zig over C for Systems Programming by raincole on Friday November 13, 2026 @01:39PM (#50487849)
All the programming languages that didn't already have enough inertia when Claude Code came out will be irrelevant.
Re:Why Zig over C for Systems Programming by mglvsky on Friday November 13, 2026 @02:07PM (#50488252)
But... but... they said about so powerful AGI/ASI, and turns out it needs "inertia"/support data and cannot improvise via any isoteric language or write directly machine code.

Poor AI

/s

Re:Why Zig over C for Systems Programming by raincole on Friday November 13, 2026 @02:29PM (#50488515)
Yeah, I think AI-generated assembly/machine code will be more and more common. The human-oriented programming language popularity ranks will be pretty much "fixed" from 2025 onwards.

No /s

Re:Why Zig over C for Systems Programming by Fervicus on Friday November 13, 2026 @01:43PM (#50487902)
> Zig is just trying to be a middle ground, which we've established doesn't work

We did?

Re:Why Zig over C for Systems Programming by anttiharju on Friday November 13, 2026 @02:54PM (#50488794)
Zig's C compiler is super handy for cross-compiling Rust
Re:Why Zig over C for Systems Programming by lukaslalinsky on Friday November 13, 2026 @03:00PM (#50488853)
That's overly confident. When I see Rust code, I'm immediately reminded of Scala and how it was supposed to take over the JVM world, but did not, and Kotlin, a much simpler language, is getting more and more popular. You might claim that LLMs have no problem with that kind of language complexity, but people still need to review stuff. I have no doubt that Rust will reach C++ level of popularity, but that still leaves a lot of space for other low-level languages.
Re:Why Zig over C for Systems Programming by 14113 on Friday November 13, 2026 @03:28PM (#50489181)
Scala "failed" for two reasons: Firstly, (like Haskell) it quickly exceeded its weirdness budget, and cultivated a community that embraced and sustained that weirdness. Secondly, a number of prominent individuals publicly expressed political views that made it hard for engineers in "mainstream" organisations to loudly promote Scala.

I think Rust is doing much better on both fronts. It has always been a more pragmatic language than Scala, and the way it is developed supports that, rather than pushing the weirdness budget higher. The overall political lean of the Rust community is also more amenable to support in mainstream institutions + companies.

Re:Why Zig over C for Systems Programming by shevy-java on Friday November 13, 2026 @11:40AM (#50486039)
"C is not going away and I still read a lot of it, because the UNIX source code and most system libraries are written in C and their man pages document them with C prototypes. But for new code I choose Zig."

Has this aged well though?

The TechBros pour in tons of money into "agentic programming" or "agentic workflows" right now. You can see that all over the place; OmarchySlop and other AI-controlled projects, where Claude is now the main designer. So in such a scenario, where does Zig really fit in? The "but for new code I choose Zig" is not a really compelling argument IMO. It reminds me of the issues that D has ("we are the better C++!!!" or even Java too). It's interesting that so many languages try to replace C. All failed, IMO. And C is still a pretty bad language. For instance, I think almost everyone would concede that crates in Rust are useful or good; C++ kind of submitted to this and has their own variant now as far as I know. C does not - or perhaps it has but almost nobody would know it.

I kind of want a language that really sits like in both camps: compiled, and scripting use. But each language seems to just fail hard in one area. Including syntax-wise. Complexity-wise too; I find Rust annoyingly complicated. Go is in many ways simpler than Rust, but it sucks in other ways. Of course there are always trade-offs either way, but I kind of want a language that can offer insane speed while having a great syntax (crystal also fails here; it is fast but the syntax is pretty bad. Why is "alias xyz abc" not working? It's so easy to support. But anyway I could go on for years here.)

Re:Why Zig over C for Systems Programming by brabel on Friday November 13, 2026 @12:18PM (#50486596)
My goto language for both fast and still scriptable is Dart. They invested a lot in UX and performance in the last few years and it shows. Run as a script or compile to a small binary that runs pretty fast, similar to Go performance as as as I have bothered to check. Best DX out there even if you don’t care about Flutter.
Re:Why Zig over C for Systems Programming by eliasdejong on Friday November 13, 2026 @12:40PM (#50486940)
Check out Mojo, a compiled language by the creator of LLVM with Python syntax.
Re:Why Zig over C for Systems Programming by hn_submit on Friday November 13, 2026 @12:02PM (#50486365)
I'd much rather read why Zig over Rust. The syntax looks very much alike and they're both for Systems Programming (although both are probably used for Application Programming).

The warts and pitfalls of C are well known, but why would one not choose Rust? I personally feel that Zig is superfluous. I'd either stick with C or would move right onto Rust.

Re:Why Zig over C for Systems Programming by dava96 on Friday November 13, 2026 @12:36PM (#50486863)
I've been toying with the idea of learning zig and weirdly enough I was looking at this guys book. I don't have any experience with low level languages. The closest I've gotten is Go.

I was debating between C and Zig, but I still don't really know what I want to choose. Feels like C is probably the right choice given the languages age and it could technically be more useful (not that I'd be looking for a job doing C work).

For those that know both, what would you pick?

Re:Why Zig over C for Systems Programming by meerita on Friday November 13, 2026 @12:44PM (#50487013)
It depends for what you want it. If you're going to do an API, well, Golang is more practical here in my opinion. For TUI apps, I would dare to say Rust was more pleasant than Golang. My experience with Zig was limited, I would not say is not a good fit.
Re:Why Zig over C for Systems Programming by kev009 on Friday November 13, 2026 @12:46PM (#50487048)
C is still supreme for working on the majority for a Linux/BSD system stack. It also imparts skill that transcend to most other spaces where you may eventually need an FFI to interact with a library anyway or understand how it actually runs on a system.
Re:Why Zig over C for Systems Programming by mmilunic on Friday November 13, 2026 @12:50PM (#50487104)
I would say from a pedagogical perspective, learning C is hugely useful for understanding how programming works at a much lower level.

This has the benefit of you learning about manual memory management and how to deal with all the issues that come with such a rules free language like C that will basically let you do anything. This understanding means lot of the constraints and features that safer languages like Zig and Rust add start to make a lot more sense. For example, going from Python to Rust, the borrow checker will probably seem rather arbitrary, but going from C to Rust, you will find the borrow checker is just automating a lot of checks you were already doing yourself.

TLDR: Learn C. I would recommend the 15122 CMU course as a pretty good foundation. You can find it online here https://www.cs.cmu.edu/~15122/schedule.shtml .

Re:Why Zig over C for Systems Programming by SoftTalker on Friday November 13, 2026 @01:56PM (#50488077)
For that matter, assembly is useful as well. Not that you have to become an expert in it, but do enough that you understand it from a practical standpoint. It doesn't even have to be on x86, use an emulator of something simple like a 6809 or 6502. I never had trouble understanding pointers in C once I had some experience writing assembly code.
Re:Why Zig over C for Systems Programming by pastel8739 on Friday November 13, 2026 @12:51PM (#50487114)
I think you should know C if you want to do low level stuff. It will help understand why zig (or rust) is built the way it is and what is useful about it, too.
Re:Why Zig over C for Systems Programming by asveikau on Friday November 13, 2026 @01:26PM (#50487647)
Just from the first example:

    struct user *user_new(const char *name, size_t n_groups)
    {
        struct user *u = malloc(sizeof *u);
        if (u == NULL)
            goto fail;
        u->name = strdup(name);
        if (u->name == NULL)
            goto fail_user;
        u->groups = calloc(n_groups, sizeof *u->groups);
        if (u->groups == NULL)
            goto fail_name;
        return u;

    fail_name:
        free(u->name);
    fail_user:
        free(u);
    fail:
        return NULL;
    }
I think you can represent C better than this. I like to focus on one cleanup block, and exploit the fact that free(NULL) is a no-op.

    struct user *user_new(const char *name, size_t n_groups)
    {
        struct user *u = calloc(sizeof *u, 1);
        if (u == NULL)
            goto fail;
        u->name = strdup(name);
        if (u->name == NULL)
            goto fail;
        u->groups = calloc(n_groups, sizeof *u->groups);
        if (u->groups == NULL)
            goto fail;
        return u;
    fail:
        if (u)
        {
            free(u->name);
            free(u->groups);
        }
        free(u);
        return NULL;
    }
Although note that this assumes calloc(sizeof *u, 1) initializes pointers to NULL, IIRC assuming the bit pattern of NULL is all zeroes is technically against the standard but every system you're likely to target will still work.
Re:Why Zig over C for Systems Programming by dgan on Friday November 13, 2026 @02:05PM (#50488218)
cynical take, but I like being employed. So it's C++ for me
Re:Why Zig over C for Systems Programming by Kevin_Flynn on Friday November 13, 2026 @02:14PM (#50488331)
As long as every new language goes to great lengths to compare itself to C ...

I'm going to keep using C.

Its in my AGENTS.md file.

Re:Why Zig over C for Systems Programming by seanw444 on Friday November 13, 2026 @02:32PM (#50488563)
Regarding the threads I'm seeing in the comments here: it's so frustrating that we have languages like Zig and Nim, among others, which are built for beauty and intuition, but then we have the naysayers that just say "everything that's not Rust or Go is dead because of LLMs, it's over, shut it down and go home".

The ability to vomit out half-baked fragile code at record speeds via plagiarism factories of unprecedented scale with little mental overhead has swung the pendulum so hard in the opposite direction of intellectualism and the human mind. This is why people are depressed about AI. It's a revolution toward soullessness.