Z

Zig NEWS

zig.news · Group blog · on HN since 2021

Community blog where Zig programmers post tutorials and technical articles on topics like build systems, thread pools, and C interop.

What HN saysHN commenters recommend it as a place to learn Zig, where many people write learning posts, alongside Ziglings and the official docs.
64HN people shared it
42linked it in comments
38stories submitted
1.4Kstory points
12 months agolast shared
2021people per year2026

Most-shared posts

  1. 1
    Struct of Arrays (SoA) in Zig? Easy and in Userland
    9 people · 3 points · first shared 2021 · discussion on HN
  2. 2
    Building SQLite with CGo for (almost) every OS
    6 people · 7 points · first shared 2022 · discussion on HN
  3. 3
    Make Zig Your C/C++ Build System
    5 people · 2 points · first shared 2022 · discussion on HN
  4. 4
    Resource efficient Thread Pools with Zig
    4 people · 314 points · first shared 2021 · 105 comments on HN
  5. 5
    Homepage
    4 people · first shared 2021
  6. 6
    Analysis of the overhead of a minimal Zig program
    2 people · 186 points · first shared 2022 · 107 comments on HN
  7. 7
    Using Zig's translate-C to understand weird C code
    2 people · 142 points · first shared 2021 · 76 comments on HN
  8. 8
    Building a Tiny Mutex
    2 people · 31 points · first shared 2022 · 2 comments on HN
  9. 9
    Fast, multi-platform, SIMD math library in Zig
    2 people · 5 points · first shared 2022 · discussion on HN
  10. 10
    Multi-Object for Loops and Struct-of-Arrays
    2 people · 3 points · first shared 2023 · discussion on HN
  11. 11
    Interfaces in Zig
    2 people · 1 points · first shared 2022 · discussion on HN
  12. 12
    Compile a c c project with zig 368j
    2 people · first shared 2023
  13. 13
    Sneaky error payloads 1aka
    2 people · first shared 2023
  14. 14
    Cross compile a c c project with zig 3599
    2 people · first shared 2021
  15. 15
    TinyVG: A challenger to the throne of vector graphics
    1 people · 551 points · first shared 2021 · 187 comments on HN

What HN people wrote when they linked it

Jarred · 2023-01-18
- Ziglings is great - https://github.com/ratfactor/ziglings - zig.news has some good posts https://zig.news/ - Zig's language docs: https://ziglang.org/documentation/master/ - Zig's standard library code https://github.com/ziglang/zig/
trealira · 2024-11-16
> But I remember an example with some other tricky C expression/type declarator where the number of actual dereferences differed from the amount of asterisks in the code. Was it this code? void f(int *a) { void *p = &a; ***(int*(*)[])p = 1; } Reading your comment made me think of this. I tried to find the original post for this, but it seems it was deleted. I only found it again through this post: https://zig.news/sobeston/using-zig-and-translate-c-to-understand-weir…
gwenzek · 2023-07-03
I wrote a similar article but focused on how Zig design enable better C optimizations. https://zig.news/gwenzek/zig-great-design-for-great-optimizations-638
kuroguro · 2023-01-11
Picked up zig a few days ago - similar experience. The build system and c-interop is amazing, targeting any arch/os from such a small toolchain makes me never want to use makefiles or even cmake again. The language itself definitely has a learning curve tho. Found myself fighting the syntax and needing some common things like sscanf often. Btw kristoff's 4 part tutorial was really useful to integrate c libs: https://zig.news/kristoff/compile-a-c-c-project-with-zig-368j
slimsag · 2022-03-27
Super excited for Zig to make low-level coding more accessible to people outside the usual group of lifelong C hackers, as you said! That's one of the reasons I am betting on it. Check out https://zig.news too, it's where a ton of people are writing learning material / little tutorials on things.
losvedir · 2022-01-18
> Building is slow. It takes about ~3 seconds minimum which is frustratingly slow when I'm fighting basic syntax errors. I wish there was a fast zig check. > Lack of zig-analyzer makes learning hard. > zig fmt src/main.zig is nice. Wish it automatically ran on all files. I also did (well, "am doing", can only work a bit each day and am plugging through day 7 right now) AdventOfCode in Zig this year. These points here didn't resonate with me at all. I wonder if the author knew about or tried ZLS[0]. I had it on and integrated with my VSCode and it would check a lot of things as I went and format on save. I think I followed something like this[1] to set it up. [0] https://github.com/zigtools/zls [1] https://zig.news/jarredsumner/setting-up-visual-studio-code-for-writin…
cies · 2021-11-03
The article links to an article[1] named: Using Zig and Translate-C to understand weird C code Interesting read indeed. Created a new post for it here on HN: https://news.ycombinator.com/item?id=29092677 [1]: https://zig.news/sobeston/using-zig-and-translate-c-to-understand-weir…
Cloudef · 2025-10-15
It mainly comes down how the std is designed. Zig has many good building blocks like allocators, and how every function that allocates something takes one. This allows you to reuse the same code for different kind of situations. Hash maps in zig std are another great example, where you can use adapter to completely change how the data is stored and accessed while keeping the same API [1]. For example to have map with limited memory bound that automatically truncates itself, in rust you need to either write completely new data structure for this or rely on someone's crate again (indexmap). Errors in zig compose also better, in rust I find error handling really annoying. Anyhow makes it better for application development but you shouldn't use it if writing libraries. When writing zig I always feel like I can reuse pieces of existing code by combining the building blocks at hand (including freestanding targets!). While in rust I always feel like you need go for the fully tailored solution with its own gotchas, which is ironic considering how many crates there are and how many crates projects depend on vs. typical zig projects that often don't depend on lots of stuff. 1: https://zig.news/andrewrk/how-to-use-hash-map-contexts-to-save-memory-…
drjeats · 2025-08-13
Ghostty is trying to be a speed demon terminal, so I'd expect it to use ReleaseFast. The current build system docs don't prioritize one build mode over another: https://ziglang.org/learn/build-system/ > Standard optimization options allow the person running zig build to select between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. By default none of the release options are considered the preferable choice by the build script, and the user must make a decision in order to create a release build. But for more opinionated recommendations, ReleaseSafe is clearly favored: https://zig.news/kristoff/how-to-release-your-zig-applications-2h90 > ReleaseSafe should be considered the main mode to be used for releases: it applies optimizations but still maintains certain safety checks (eg overflow and array out of bound) that are absolutely worth the overhead when releasing software that deals with tricky sources of input (eg, the internet). https://zighelp.org/chapter-3/ > Users are recommended to develop their software with runtime safety enabled, despite its small speed disadvantage. If you could somehow collect real-world data, the overwhelming majority of Zig programs aren't released and have likely only made debug builds :P
kristoff_it · 2022-01-17
Hi, I'm Loris from the ZSF. I think this is a fair post overall given what it is: a log of what it was like for one specific person to use Zig for AoC for the first time. I'll spend some words on some of the things mentioned and then add some more useful advice for forrestthewoods at the end. From my perspective the complaints mostly were about now knowing things which had varying degrees of discoverability. The first point in Day 1 about mixing optionals and error unions is an example of something very easy to discover (by reading the language reference), so I personally would consider it an unlucky mistake by the author. The second point (how to print an integer) is about something way less easily discoverable than in the previous example. You need to learn about how to print, then about `fmt` and from there the only authoritative place that contains information about format specifiers is the doc comment of `std.fmt.format`. This second example is the kind of thing that we're the weakest at communicating to people because it's not a feature of the language itself (so it doesn't belong to the language reference) and, while you could in theory find this stuff in the stdlib autogenerated docs, you still have the problem of having to discover first what to search for. This is especially problematic when Zig breaks away from what's common in programming languages. One example of that is the fact that Zig has no print statement. I've given some talks and written some…
pcein · 2021-10-07
Another good resource: https://zig.news/
slyzmud · 2025-08-22
I don't know for freebsd but at least for Linux I started using the zig toolchain and it's wonderful. https://zig.news/kristoff/building-sqlite-with-cgo-for-every-os-4cic
dnautics · 2025-08-06
I wrote an article about one possible pattern which is a concrete realization of your question -- though with more ceremony and complexity since the pathway is fully compiled out if you don't use it (vs a nullable pointer strategy): > Are libraries typically designed to accept an optional input to store potential errors? https://zig.news/ityonemo/sneaky-error-payloads-1aka if you prefer video form: https://www.youtube.com/watch?v=aFeqWWJP4LE The answer is no, libraries are not typically designed with a standardized convention for payload return.
rc00 · 2025-03-18
Cross-compilation with Cgo can be resolved using something like Zig as the compilation toolchain: https://zig.news/kristoff/building-sqlite-with-cgo-for-every-os-4cic
cgh · 2024-12-15
https://ziglang.org/documentation/master/#C Zig has near-seamless C interop and the Zig compiler is also C cross-compiler: https://zig.news/kristoff/cross-compile-a-c-c-project-with-zig-3599
sitkack · 2024-07-21
That sounds really neat, is there more information on this? *Edit Found this, https://zig.news/david_vanderson/using-rr-to-quickly-debug-memory-corr…
simon_void · 2024-07-16
you could use the Zig build system as your C build system. See https://zig.news/kristoff/make-zig-your-c-c-build-system-28g5
eyegor · 2024-03-16
It has one now, but I haven't played around enough to call it "good" or "bad". It feels more like a hack than something like cargo/pip/nuget/npm/etc, but it's a lot better than the normal c/cpp experience. build.zig.zon discussion: https://zig.news/edyu/zig-package-manager-wtf-is-zon-2-0110-update-1jo… Example howto: https://ziggit.dev/t/how-to-package-a-zig-source-module-and-how-to-use… Actual docs: https://ziglang.org/download/0.11.0/release-notes.html#Package-Managem…
giovannibonetti · 2024-03-12
I wonder if a compile-time array-of-structs (AoS) to struct-of-arrays (SoA) transformation like the one done by Zig [1] could fix that issue. [1] https://zig.news/kristoff/struct-of-arrays-soa-in-zig-easy-in-userland…
laidoffamazon · 2023-12-31
Good article, the biggest paradigm shift for me thinking about ECS was also the bottom-up approach. I'm most intrigued by platforms and frameworks that automatically "ECS-ify" data structures, like Zig's MultiListArray [0] As an aside, I was surprised that the author goes to Harvard yet his resume looks shockingly normal, not terribly different (in terms of software internships) than the people I went to school with. It's bizarre, given the fact that Harvard/YPSM admits are basically superhuman in every conceivable quality compared to the rest of us mortals. [0]: https://zig.news/kristoff/struct-of-arrays-soa-in-zig-easy-in-userland…
acqq · 2023-12-15
Many thanks for this good answer, that level of detail is exactly what I have been missing up to now. I'm surely aware of the fact that C cross-compilation is often very clumsy implemented. But I also have to mention that there is a project that also tries to solve that too, while also creating a whole new language: https://zig.news/kristoff/building-sqlite-with-cgo-for-every-os-4cic
llimllib · 2023-10-04
the other pain point I know of is that it's hard to cross-compile. You can do it with zig[1], but it's still not pleasant. 1: https://zig.news/kristoff/building-sqlite-with-cgo-for-every-os-4cic
rudedogg · 2023-09-18
On the subject of AoS, Zig has a cool data structure for that: https://zig.news/kristoff/struct-of-arrays-soa-in-zig-easy-in-userland…
patmorgan23 · 2023-08-23
Zigs package manager takes this approach. https://zig.news/edyu/zig-package-manager-wtf-is-zon-558e
anotherhue · 2023-08-10
Also see: Make Zig Your C/C++ Build System https://zig.news/kristoff/make-zig-your-c-c-build-system-28g5
throwawaymaths · 2023-08-06
skybrian · 2023-08-06
This seems to be it: https://zig.news/ityonemo/sneaky-error-payloads-1aka It looks like it would be useful, but relies on a naming convention? Hopefully everyone picks the same field names.
cellularmitosis · 2023-07-03
In practice it only takes a weekend or two to pick up the syntax changes, and the benefits easily outweigh that investment. Heck, the simple fact that type signatures can be read literally from left to right (instead of using the spiral rule) is enough for me to switch. https://zig.news/toxi/typepointer-cheatsheet-3ne2
naasking · 2023-03-10
I have no dog in this race as I don't use Zig at the moment, but I'm not sure speculative is that unfair. Zig can literally be a drop-in replacement for GCC/clang [1], meaning you don't even have to fully adopt Zig as the build tool, so your initial comment about a lack of separation of concerns doesn't seem correct: just use "zig cc" for the C/C++ source if that's all you want. That said, using Zig as the build tool seems to bring trivial cross-compilation support and portability, without having to deal with linkers [2]. Cross-compilation has always been and remains a PITA, so that's pretty compelling. [1] https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-c… [2] https://zig.news/kristoff/compile-a-c-c-project-with-zig-368j

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close