Zig (programming language)
Zig is an imperative, general-purpose, statically typed, compiled system programming language designed by Andrew Kelley.[3][4] The language is designed for "robustness, optimality and maintainability",[5][6] supporting compile-time generics and reflection, cross-compilation and manual memory management.[7] A major goal of the language is to improve upon the C language,[8][9] while also taking inspiration from Rust,[10][11] among others. Zig has many features for low-level programming, notably: packed structs (structs without padding between fields), arbitrary width integers[12] and multiple pointer types.[13]
|  | |
| Paradigms | Multi-paradigm: imperative, concurrent, procedural, functional | 
|---|---|
| Designed by | Andrew Kelley | 
| First appeared | 8 February 2016[1] | 
| Preview release | |
| Typing discipline | Static, strong, inferred, structural, generic | 
| Platform | x86-64, ARM, MIPS, IA-32, WebAssembly, RISC-V | 
| OS | Cross-platform | 
| License | MIT License | 
| Filename extensions | .zig, .zir | 
| Website | ziglang | 
| Influenced by | |
| C, C++, LLVM IR, Go, Rust, JavaScript | |
The stage 1 compiler is written in Zig and C++, using LLVM 13[14] as a back-end,[15][16] supporting many of its native targets.[17] The compiler is open source under the MIT License.[18] The Zig compiler exposes the ability to compile C and C++ similarly to Clang with the commands "zig cc" and "zig c++",[19] providing many headers including libc and libcxx for many different platforms, allowing Zig's cc and c++ sub-commands to act as cross compilers out of the box.[20][21]
Zig development is funded by the Zig Software Foundation (ZSF), a non-profit corporation with Andrew Kelley as president, which takes in donations and hires multiple full-time employees.[22][23][24]
Examples
    
    Hello World
    
const std = @import("std");
pub fn main() !void {
    const stdout = std.io.getStdOut().writer();
    try stdout.print("Hello, {}!\n", .{"world"});
}
Generic linked list
    
pub fn main() void {
    var node = LinkedList(i32).Node {
        .prev = null,
        .next = null,
        .data = 1234,
    };
    var list = LinkedList(i32) {
        .first = &node,
        .last = &node,
        .len = 1,
    };
}
fn LinkedList(comptime T: type) type {
    return struct {
        pub const Node = struct {
            prev: ?*Node,
            next: ?*Node,
            data: T,
        };
        first: ?*Node,
        last:  ?*Node,
        len:   usize,
    };
}
References
    
- Kelley, Andrew. "Introduction to the Zig Programming Language". andrewkelley.me. Retrieved 8 November 2020.
- "Release 0.9.1".
- "Zig has all the elegant simplicity of C, minus all the ways to shoot yourself in the foot". JAXenter. 2017-10-31. Retrieved 2020-02-11.
- "Tired of C? New programming language Zig aims to be more pragmatic and readable". 2017-10-19. Retrieved 2020-04-22.
- Yegulalp, Serdar (2016-08-29). "New challenger joins Rust to topple C language". InfoWorld. Retrieved 2020-02-11.
- "Zig language and C". Sina Corp. 2020-07-12. Retrieved 2020-08-12.
- "The Zig Programming Language". ziglang.org. Retrieved 2020-02-11.
- "Mozilla's Observatory, the Zig programming language, and uSens' VR/AR SDK—SD Times news digest: Aug. 29, 2016". SD Times. 2016-08-29. Retrieved 2020-02-11.
- "The Zig Programming Language". ziglang.org. Retrieved 2020-02-11.
- Company, Sudo Null. "Sudo Null - IT News for you". SudoNull. Retrieved 2020-02-11.
- Kelley, Andrew. "Unsafe Zig is Safer Than Unsafe Rust". andrewkelley.me. Retrieved 2020-02-11.
- Tim Anderson 24 Apr 2020 at 09:50. "Keen to go _ExtInt? LLVM Clang compiler adds support for custom width integers". www.theregister.co.uk. Retrieved 2020-04-24.
- "Documentation - The Zig Programming Language". ziglang.org. Retrieved 2020-04-24.
- "SD Times news digest: C++20 concepts in Visual Studio 2010 version 16.3, Bootstrap to drop IE support, and Zig 0.60 released". SD Times. 2020-04-14. Retrieved 2020-04-19.
- "A Reply to _The Road to Zig 1.0_". www.gingerbill.org. 2019-05-13. Retrieved 2020-02-11.
- ziglang/zig, Zig Programming Language, 2020-02-11, retrieved 2020-02-11
- "The Zig Programming Language". ziglang.org. Retrieved 2020-02-11.
- "ziglang/zig". GitHub. Retrieved 2020-02-11.
- "0.6.0 Release Notes · The Zig Programming Language". ziglang.org. Retrieved 2020-04-19.
- "'zig cc': a Powerful Drop-In Replacement for GCC/Clang - Andrew Kelley". andrewkelley.me. Retrieved 2021-05-28.
- "Zig Makes Go Cross Compilation Just Work". DEV Community. Retrieved 2021-05-28.
-  "Jakub Konka on Twitter". Twitter. Retrieved 2021-05-28.{{cite web}}: CS1 maint: url-status (link)
- "Announcing the Zig Software Foundation ⚡ Zig Programming Language". ziglang.org. Retrieved 2021-05-28.
- "Sponsor ZSF ⚡ Zig Programming Language". ziglang.org. Retrieved 2021-05-28.


