zig
Systems programming language and compiler
TLDR
Compile and run a file
SYNOPSIS
zig [command] [options] [arguments]
DESCRIPTION
Zig is a systems programming language focused on safety, performance, and maintainability. The zig command is both a compiler and build system.
Key features include compile-time code execution (comptime), optional safety checks, C interoperability, and built-in cross-compilation to many targets without external toolchains.
Zig can also serve as a drop-in C/C++ compiler (zig cc, zig c++) with consistent cross-compilation capabilities, making it useful even for non-Zig projects.
The build system uses build.zig files written in Zig itself, providing full language power for build configuration.
PARAMETERS
-O mode
Optimization mode (Debug, ReleaseSafe, ReleaseFast, ReleaseSmall)-target triple
Cross-compilation target-I dir
Add include directory-l lib
Link library-femit-asm
Output assembly-freference-trace
Show compile error reference traces
SUBCOMMANDS
build
Build project using build.zigbuild-exe
Compile to executablebuild-lib
Compile to librarybuild-obj
Compile to object filerun
Compile and run immediatelytest
Run unit testsfmt
Format source codecc
Use Zig as a C compilerc++
Use Zig as a C++ compilertranslate-c
Translate C code to Ziginit-exe
Initialize executable projectinit-lib
Initialize library project
CAVEATS
Zig is still pre-1.0 and the language/standard library may change between versions.
Debug builds include runtime safety checks that catch bugs but have performance overhead.
Cross-compilation is powerful but target-specific system libraries may still be needed for some features.
