Why you should know what Zig is?

C++, Rust, now Zig? Not exactly…

Greg Thomas
Vets in DevOps
3 min readJan 4, 2024

--

Zig Logo
zig-logo-dark.svg — https://github.com/ziglang/logo

I am not a software engineer by trade but I am always learning and extremely curious. For instance about 5 years ago when I stumbled across the Go programming language I fell in love quickly. I never got around to learning C++ like most, and I heard Rust was akin to Go in that it was great for preventing attacks against memory, unlike C++ which runs many critical systems. I stumbled across an article that intrigued me a bit and made me dig deeper into Rust, which then led me to Zig! Oh, the rabbit holes we go into in tech.

So where do Zig, Rust, and C fit in the puzzle? What should you try to learn next? Well, it remains to be seen but it also depends! Here is a simple summary before we proceed.

Zig supports compile time generics, reflection and evaluation, cross-compiling, and manual memory management. A major goal of the language is to improve on the C language, while also taking inspiration from Rust, among others. (Link)

With Zig and Rust, I am most interested in information security specifically memory-safe languages for critical systems. With a few quick code examples, I was able to test out the detection of memory leaks! Not on a critical system but still interesting. By no means is this all Zig is good for, just novel but interesting.

https://ziglang.org/learn/samples/

Will I ever go back and learn C++? At this point in my life, no. Many already know it and have been using it for decades and that is great. I am sure the latest LLM will help with that. Would I consider diving even deeper into Zig? Yes!

I like the analogy of bug repellent and how it only stops some bugs when explaining the value of Zig. It leverages memory allocation or the removal of such to prevent developers from writing unsafe code or having a bug land on you! It acts sort of as a taint or repellent. Having bugs land on mission-critical systems is bad. Could Zig help secure some of these mission-critical systems that keep us up at night?

Like Bob Ross says the more you know!

https://images.app.goo.gl/Qssz9LxKBeXAB9WeA

Thanks for following along with my ramblings and I hope you learned a bit.

--

--