33 lines
1.3 KiB
Markdown
33 lines
1.3 KiB
Markdown
---
|
|
title: "Zig"
|
|
category: "Languages and runtimes"
|
|
tagline: "A small systems language, and a C and C++ compiler that cross-compiles out of the box."
|
|
source: "pacman"
|
|
package: "zig"
|
|
command: "zig"
|
|
website: "https://ziglang.org/"
|
|
code: "https://codeberg.org/ziglang/zig"
|
|
links:
|
|
- name: "Zig documentation"
|
|
url: "https://ziglang.org/documentation/master/"
|
|
---
|
|
|
|
## What it is
|
|
|
|
Zig is a general-purpose systems programming language, meant as a simpler alternative to C. It has no hidden control flow or hidden memory allocations, runs code at compile time with `comptime`, and comes with its own build system. The `zig` command can also compile C and C++, and cross-compile for other operating systems and processors without extra toolchains.
|
|
|
|
## Why it's here
|
|
|
|
- **Low-level without the surprises.** Manual memory management, with checks that catch many mistakes in debug builds.
|
|
- **A better C toolchain.** `zig cc` builds C code for other targets with nothing else to install.
|
|
- **Builds the tools you use.** Some terminal apps and libraries are written in Zig and build with it.
|
|
|
|
## On CoreDesktop
|
|
|
|
Zig is installed from pacman, alongside Go, Rust, Node.js, Python and Bun. `update` keeps it current with the rest of the pacman packages. For another version in one project, use [mise](/software/mise/).
|
|
|
|
```
|
|
zig init
|
|
zig build run
|
|
```
|