Zig (programming language)

[4] [5] [6] [7] [8] [9] [10] Zig (Also known as Ziglang)[12] is an imperative, general-purpose, statically typed, compiled system programming language designed by Andrew Kelley.

[19] The improvements in language simplicity relate to flow control, function calls, library imports, variable declaration and Unicode support.

Features adopted from modern languages include the addition of compile time generic programming data types, allowing functions to work on a variety of data, along with a small set of new compiler directives to allow access to the information about those types using reflective programming (reflection).

[20] To help eliminate the potential errors that arise in such systems, it includes option types, a simple syntax for using them, and a unit testing framework built into the language.

[22] The main drawback of the system is that, although Zig has a growing community, as of 2025, it remains a new language with areas for improvement in maturity, ecosystem and tooling.

[23] The availability of learning resources is limited for complex use cases, though this is gradually improving as interest and adoption increase.

[23] The development is funded by the Zig Software Foundation (ZSF), a non-profit corporation with Andrew Kelley as president, which accepts donations and hires multiple full-time employees.

[27] Despite this, a Stack Overflow survey in 2024 found that Zig software developers earn salaries of $103,000 USD per year on average, making it one of the best-paying programming languages.

[18] In keeping with the overall design philosophy of making the code simple and easy to read, the Zig system as a whole also encompasses a number of stylistic changes compared to C and other C-like languages.

[30] A common solution to these problems is a garbage collector (GC), which examines the program for pointers to previously allocated memory, and removing any blocks that no longer have anything pointing to them.

For instance, creating a pointer with a null value and then attempting to use it is perfectly acceptable in C, leading to null-pointer errors.

In Zig, this could be implemented as an var theCountedUsers: ?i32 = null which sets the variable to a clear "not been called" value.

[33] Another more general feature of Zig that also helps manage memory problems is the concept of defer, which marks some code to be performed at the end of a function no matter what happens, including possible runtime errors.

If a particular function allocates some memory and then disposes of it when the operation is complete, one can add a line to defer a free to ensure it is released no matter what happens.

[33] By using the comptime keyword, the programmer can explicitly have Zig evaluate sections of code at compile time, as opposed to runtime.

This allows Zig’s cc and c++ sub-commands to act as cross compilers out of the box (similarly to Clang).

These include not only widely-used modern systems like ARM and x86-64, but also PowerPC, SPARC, MIPS, RISC-V and even the IBM z/Architectures (S390).

[38] The previous bootstrapping compiler, written in Zig and C++ using LLVM as a back-end,[39][40] supporting many of its native targets,[41] was removed in version 0.11.