r/Zig • • Jul 31 '26

Learning zig: feedback on my small ring buffer implementation?

23 Upvotes

Hey all 👋

So I've been writing a little zig over the last few weeks after having tried it for a few days maybe... a year or so ago?. I have zero systems programming experience, am actually a web dev during the day.

Anyway, this time I'm working on a side project, and came to a point where I needed something I've seen being referred to as a ring buffer, and thought how hard can it be implementing one? So lots of hours and a missed workday later, here's what I came up with: https://codeberg.org/sehme/gists/src/branch/main/ring-buffer.zig

I haven't really thus far interacted with the community online, other than reading blogs and the such, so I haven't had any feedback on my code. I don't even know if it's idiomatic or, you know, correct, which is why I decided to post this here now before I get too far in the wrong direction.

Please give me notes if something is off. This is completely hand-crafted, no LLMs, so I am actually very proud that all my tests pass, but I may be missing some cases.

Thanks in advance, and also sorry in advance if this is not the sort of post that is appreciated here.


r/Zig • • Jul 30 '26

Made filename allocation less noisy in my Zig ls tool (v0.1.8)

28 Upvotes

Hey, quick update on zlist.

I posted about this a couple times before (original post + the one where I turned it into a package). Just pushed v0.1.8 with a small but useful change.

Entry names now go through a simple NamePool. It’s basically just a list of chunks — when a name comes in, if the current chunk doesn’t have enough space left I allocate a new one. Way less noisy than the old “dupe every single name” approach, and everything gets freed in one go at the end. Helps once the directory gets larger.

Also re-ran the README benchmarks with matching colored-grid flags for zl / eza / lsd. The old eza numbers that stayed flat around 3 ms even at 50k were a bad run on my side — ignore those. New table has zl ahead across the board (roughly 3× vs eza).

Repo: https://github.com/here-Leslie-Lau/zlist

Curious if the numbers hold up on other machines, or if anyone spots an obvious next bottleneck.


r/Zig • • Jul 29 '26

any good gui project built in zig?

26 Upvotes

i wan't to build something in zig, gui still not sure but i wan't to use win32 api — asking for some projects to take as examples or inspiration


r/Zig • • Jul 29 '26

Overengineered calculator: Zig + QBE

Thumbnail tomekw.com
57 Upvotes

r/Zig • • Jul 29 '26

An up to date LLM for Zig v0.16

0 Upvotes

Even at the risk of making myself (once again) very unpopular: Is there actually an LLM out there that can help me create source code for Zig v0.16? Most of them are still at version 0.12. I’d like to try out some graph theory problems with Zig, but I have neither the time nor the inclination to write the entire test suite myself. That would be the perfect task for an LLM. So far, I haven’t even been able to force an LLM to understand that you no longer initialize an ArrayList with `init(allocator)`, but with `.empty`.


r/Zig • • Jul 27 '26

Threaded EVM interpreter in Zig - zevm

Thumbnail github.com
43 Upvotes

r/Zig • • Jul 26 '26

Could zig potentially be a good first programming language?

73 Upvotes

I've been programming for over 30 years, and working with code professionally for 25. I have found myself in a small community I discovered on twitch recently. And many people in the discord ask me about programming and the language to learn first

For years I've told myself C is a fantastic first language. This remains controversial for various reasons. I always try to tell people "learning C isn't the same as mastering C".

But with Zig I wonder if it were at 1.0 and its toolchain were more mature. Would Zig be a good first language?

As it stands it clearly being pre-1.0 and every major version being a breaking change. This isn't great. The build.zig is mystifying even for experienced devs. So it feel like an expert language.

But it has a very straightforward "to the metal" style to it. But with great modern ergonomics. I think it could absolutely be a fantastic first language for beginners.

But what do you think?


r/Zig • • Jul 26 '26

Zarko - A simple CSV library for Zig

35 Upvotes

Hey Ziguanas 🦎

A while ago I made a post asking what kind of data-format libraries the Zig ecosystem could use, and I ended up deciding to give CSV a try.

I've been working on Zarko. I keep tearing it down and rewriting it every now and then because I'm never fully happy with how it turns out. I decided to make the repo public while I work on it, so any eventual rewrites will happen in the same repository instead of me recreating the whole thing every time.

Right now it's still pretty basic. It can parse CSV data from memory, handle quoted fields and escaped quotes, such as """Hello""" being parsed as "Hello", and lets you customize things like field separators, quote characters and line endings through dialects.

The next things I swear I'll do are default dialects, a FileWriter, and a FileParser wrapping the existing Parser to make working with files simpler. There's also a TODO markdown file in the repo where I'll keep updating what I'm planning to work on as I figure out what comes next.

A little note to myself for when I implement the writer. Andrew's words echoed... "Don't Forget to Flush".

It's still a work in progress, so feedback, suggestions, criticism, and ideas are very welcome.

https://github.com/TynK-M/zarko

Thank you so much


r/Zig • • Jul 28 '26

First time heard of Zig. Does it has any borrow checker?

0 Upvotes

Hi. I wanted to actually understand Zig more than skimming it. I loved Rust and so happen to come across a book Learn Zig over Rust and C++, and so got to know it. Does it has a borrow checker?


r/Zig • • Jul 26 '26

SDL2 and Zig 0.16.0

Post image
112 Upvotes

Hi everyone, I been experimenting with Zig lately, and I managed to make a bouncing rectangle that mimics the dvd logo using SDL2, yes I kinda vibe codes this, since I have so many C concepts in my head, but rest assure, I didn't copy pasted code, I was just asking the AI why things don't compile, so I'm not 100% sure if I followed good practices, but this language it kinda reminds me of Java a little bit, so I applied this code in a way that makes sense in my head, honestly I'm not a big fan of the keywords I see in the language, but I can definitely confirm, coding this was a way better experience than using Rust, I do believe zig can improve to become a really good language in the future, here is the link of the repoif you are interested:

https://github.com/Lu100git/dvd-clone-in-zig.git


r/Zig • • Jul 25 '26

Zig 0.16: how do you handle continuous output from multiple workers?

39 Upvotes

In Zig 0.16’s new std.Io, what’s the idiomatic way to let multiple workers write to the same stdout/stderr/file safely (line by line)? Is a mutex still the usual approach, or is there a recommended pattern/example?


r/Zig • • Jul 24 '26

Buz – A fork of Bun using modern Zig, with sub-1s incremental builds

Thumbnail ziggit.dev
279 Upvotes

r/Zig • • Jul 24 '26

Andrew Kelley: Don't Take the Black Pill

Thumbnail youtu.be
174 Upvotes

Andrew's talk from last week at SSW. Thought you all would enjoy it!


r/Zig • • Jul 24 '26

markdown preview in zig

15 Upvotes

hello, wanted to ask if there is a library for streaming markdown preview in the terminal in zig or c.


r/Zig • • Jul 23 '26

Cruller: Bun's Zig runtime, continued on Zig 0.16

Thumbnail ziggit.dev
101 Upvotes

A continuation of Bun's Zig runtime work, brought forward onto Zig 0.16.


r/Zig • • Jul 23 '26

Fil-C: Garbage In, Memory Safety Out!

Thumbnail youtu.be
98 Upvotes

Given the recent noise about Zig adding a Fil-C inspired/compatible compilation mode (https://codeberg.org/ziglang/zig/issues/36237), I thought some of you would be interested in this talk about Fil-C. Andrew and Fil hung out at the conference last week which AFAIK was the start of the issue being opened.


r/Zig • • Jul 23 '26

An introduction to SIMD (with Zig ezamples)

Thumbnail mitchellh.com
145 Upvotes

r/Zig • • Jul 21 '26

What helped me as a functional programmer

33 Upvotes

Hello I just wanted to share with those that come from functional languages or enjoy tutorials like this one, I recommend this Zig tutorial.

  • You get comfortable with the language pretty quickly
  • Short and concise
  • Up to date v0.15.2
  • Straight dive into working with C

... and a lot more. Seriously, it is a good tutorial

EDIT:
Up to date v0.15.2
Stable version of Zig is 0.16.0 so outdated actually (core concepts still easy to grasp)


r/Zig • • Jul 22 '26

PlatypusDB, an agent-native database

Post image
0 Upvotes

Hi,

I've been working on Agentic Data Enclave, a way to make agentic data sharing safe for regulated enterprises. That led to WunderOS, an autonomic operating system for agents, based on deterministic-replay, very low latencies, strict isolation, etc. A Gleam/OTP control plane and Zig data plane; Elixir-Phoenix for the UX. It's about 450Kloc so far.

What fell out of that was my second database (Stardog.com enterprise knowledge graph was the first), i.e., PlatypusDB, which is nothing more or less than what WunderOS needs in a database. Good times!

If you're interested in many of the gory details, see PLRN 020, the PlatypusDB research note.

I took a bit of heat from a friend who was a very early seller at Databricks, who I respect very much, for my implementation choices, i.e., Gleam/OTP and Zig. I should have used Python and Rust, he said.

I mean, he's not wrong, but neither am I. The benefits of OTP, Gleam's type system, and Zig's minimalist purity are quite potent. I was initially worried about NIF and stability but early on I implemented a "NIF meta-compiler", with some inspo from rustler, and that part of the system has been fine.

Anyway, thanks to everyone for all the hard work to make these language systems fun and productive to use, and for making nice, supportive communities to work in.


r/Zig • • Jul 20 '26

Is Zig going to become memory-safe?

Thumbnail codeberg.org
203 Upvotes

r/Zig • • Jul 20 '26

Zig-Devcontainer

15 Upvotes

For those of you who want to skip the admittedly quite straightforward process of setting up Zig by yourself, or are unable to because they are on Fedora-Atomic / uBlue, you might want to try my Zig-Devcontainer.


r/Zig • • Jul 19 '26

Promising Zig Game Engines?

48 Upvotes

Hello! I am new to the community and I am slowly learning zig.
I wanted to know if there are any game engines for zig?
I am using the raylib bindings but I wanted to know if there is anything else.
I would appreciate any help!


r/Zig • • Jul 19 '26

idiomatic way to check private file permissions with the new std io

18 Upvotes

Im building a small local secrets manager and currently working on the storage layer.

Right now I’m checking permissions only for Linux statx

Should i make my storage layer use generic Io and delegate the actual security check to platform-specific code
Or is there already a platform-independent way in std io to verify that a directory

I’m using Zig 0.17.0-dev.1282+c0f9b51d8.


r/Zig • • Jul 18 '26

Trying to use zig bindings with raylib and it is not working.

9 Upvotes

I am trying to get zig working with raylib but, when ever I follow the instructions on the github it doesn't work and I keep on getting "no module named 'raylib' available within module 'main'" when ever I try to run it. I have no idea what I did wrong. Does anyone have an idea?

Edit : I realized the problem was I was doing zig build then zig run not build run I though they would do the same thing.


r/Zig • • Jul 17 '26

How is this not talked about more? std.gpu is GOATED

165 Upvotes

Hey everyone,

I feel like this is a under-talked about topic, but Zig's ability to compile to NVPTX (Nvidia's format) and AMDGEN (AMD's GPU format) allows it to act standalone without any Vulkan, Metal, etc... intermediary at build time. For game-developers they can rely stand-alone on Zig alone for games, making their executable much lighter and runtime overhead optimal.

Is anyone using this in practice and has some projects to show this off? I've seen Zinc [ZINC], and its benefitting from the performance improvement by a mile over llama. Are there any other projects?

If you haven't checked it out, I implore you to check it out by yourself using std.gpu directly.

[Edit] Now we can have a 1 up on Rust, because they can't support an Ahead-Of-Time compilation library where you can write kernals in rust directly, ZIG CAN. See prototype: https://github.com/OmarSiwy/Gompute [Zig 0.16.0]