The Zig Programming Language

The Zig programming language is a relatively young open source general purpose programming language. Joining a growing list of languages in our Programming Language playlist, Zig can be thought of as “Zig is to C as Rust is to C++”. It’s a relatively simple programming language with modern language features like generics, while offering manual memory management, exceptional C interop and more. It is built on top of the LLVM compiler and includes C and C++ compilers as well as the StdC libraries.

Zig is described as:

A Simple Language

Focus on debugging your application rather than debugging your programming language knowledge.

  • No hidden control flow.
  • No hidden memory allocations.
  • No preprocessor, no macros.

Comptime

A fresh approach to metaprogramming based on compile-time code execution and lazy evaluation.

  • Call any function at compile-time.
  • Manipulate types as values without runtime overhead.
  • Comptime emulates the target architecture.

Performance Meets Safety

Write fast, clear code capable of handling all error conditions.

  • The language gracefully guides your error handling logic.
  • Configurable runtime checks help you strike a balance between performance and safety guarantees.
  • Take advantage of vector types to express SIMD instructions portably.

If you are interested in learning Zig, the website is https://ziglang.org/. The project is open source under the MIT license with the source code hosted on GitHub. If you have any comments or questions you can check out the official Zig discord server here.

Of course, this is a game development channel, so you may be wondering how you create games with Zig. If you are interested in getting up and running with SDL, this is an excellent tutorial. If you would prefer Raylib of course there are bindings for Zig available here. Due to the straight forward C interop, working with any C library should be a fairly trivial process.

You can learn more about Zig in the video below.