Zig

✍ dations ◷ 2025-08-18 06:50:14 #Zig

Zig是一个命令式、通用、静态类型、编译的系统编程语言。 以“强健性、最佳性以及可维护性”为核心理念。 它支持编译时泛型与反射、交叉编译以及手动存储器管理。 目标为改进 C语言 ,同时参考从 Rust 和其他语言。Zig 有许多低端程序设计的功能,例如紧致结构(成员间没有填充的结构)、任意大小的整数以及多指针类型。

Zig 最初的编译器是用 Zig 和 C++ 编写而成,以 LLVM 13 为后端 。这个编译器使用 MIT许可证 授权。Zig 编译器和 Clang 类似,能编译 C 与 C++(使用“zig cc”以及“zig c++”指令),也为不同的平台提供头文件,包括 C标准库 和 C++标准库,因此 Zig 的 cc 与 c++ 子命令能直接作为交叉编译器。

Zig 的开发由 Zig 软件基金会 (ZSF) 资助,该资金会是一家非营利公司,由 Andrew Kelley 担任总裁,也有雇佣一些全职员工,同时接受捐款。

const std = @import("std");pub fn main() !void {    const stdout = std.io.getStdOut().writer();    try stdout.print("Hello, {}!n", .{"world"});}

链接串列

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,    };}

参见

  • C
  • C++
  • Nim
  • Rust
  • D

参考资料

  1. ^ Kelley, Andrew. Introduction to the Zig Programming Language. andrewkelley.me. . (原始内容存档于2022-02-21). 
  2. ^ 2.0 2.1 https://ziglang.org/download/#release-0.10.1.
  3. ^ Zig has all the elegant simplicity of C, minus all the ways to shoot yourself in the foot. JAXenter. 2017-10-31 . (原始内容存档于2021-11-25) (美国英语). 
  4. ^ Tired of C? New programming language Zig aims to be more pragmatic and readable. 2017-10-19 . (原始内容存档于2021-11-25) (美国英语). 
  5. ^ Yegulalp, Serdar. New challenger joins Rust to topple C language. InfoWorld. 2016-08-29 . (原始内容存档于2021-11-25) (英语). 
  6. ^ Zig language and C. Sina Corp. 2020-07-12 . (原始内容存档于2021-11-25). 
  7. ^ The Zig Programming Language. ziglang.org. . (原始内容存档于2022-04-01). 
  8. ^ Mozilla's Observatory, the Zig programming language, and uSens' VR/AR SDK—SD Times news digest: Aug. 29, 2016. SD Times. 2016-08-29 . (原始内容存档于2021-11-25) (美国英语). 
  9. ^ The Zig Programming Language. ziglang.org. . (原始内容存档于2022-04-01). 
  10. ^ Company, Sudo Null. Sudo Null - IT News for you. SudoNull. . (原始内容存档于2021-11-25) (英语). 
  11. ^ Kelley, Andrew. Unsafe Zig is Safer Than Unsafe Rust. andrewkelley.me. . (原始内容存档于2022-02-21). 
  12. ^ 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. . (原始内容存档于2020-05-15) (英语). 
  13. ^ Documentation - The Zig Programming Language. ziglang.org. . (原始内容存档于2022-03-31). 
  14. ^ 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 . (原始内容存档于2021-11-25) (美国英语). 
  15. ^ A Reply to _The Road to Zig 1.0_. www.gingerbill.org. 2019-05-13 . (原始内容存档于2021-09-07) (英国英语). 
  16. ^ ziglang/zig, Zig Programming Language, 2020-02-11 , (原始内容存档于2022-03-30) 
  17. ^ 0.6.0 Release Notes · The Zig Programming Language. ziglang.org. . (原始内容存档于2022-02-21). 
  18. ^ 'zig cc': a Powerful Drop-In Replacement for GCC/Clang - Andrew Kelley. andrewkelley.me. . (原始内容存档于2022-03-17). 
  19. ^ Zig Makes Go Cross Compilation Just Work. DEV Community. . (原始内容存档于2022-03-03) (英语). 
  20. ^ Jakub Konka on Twitter. Twitter. . (原始内容存档于2021-12-01) (英语). 
  21. ^ Announcing the Zig Software Foundation ⚡ Zig Programming Language. ziglang.org. . (原始内容存档于2021-11-15). 
  22. ^ Sponsor ZSF ⚡ Zig Programming Language. ziglang.org. . (原始内容存档于2022-02-21). 

外部连接

  • 官方网站
  • GitHub (页面存档备份,存于互联网档案馆)

相关

  • 风化作用风化作用为岩石、土壤及其矿物等与地球大气层接触而分解。风化作用发生在当地或无包含物体移动,所以不能和侵蚀作用互相混淆。侵蚀作用包括岩石和矿物经由媒介如水、冰、风及
  • 纳弗沙岛纳瓦萨岛(英语:Navassa Island、海地克里奥尔语:Lanavaz)是加勒比海无人居住的小岛,是美国的非建制领土,海地亦宣称所有。纳瓦萨岛面积大约5.2平方公里(2平方英里)。岛的经度和纬度
  • 校对符号؋ ​₳ ​฿ ​₿ ​₵ ​¢ ​₡ ​₢(英语:Brazilian cruzeiro) ​$ ​₫ ​₯ ​֏ ​₠ ​€ ​ƒ(英语:Florin sign) ​₣ ​₲ ​₴(英语:Hryvnia sign) ​₭ ​₺ ​₾ ​₼
  • 亨利·德·巴耶-拉图尔亨利·德·巴耶-拉图尔伯爵(Henri de Baillet-Latour,1876年3月1日-1942年1月6日),比利时人,于1925年至1942年担任第三任国际奥林匹克委员会主席。拉图尔是从比利时鲁汶大学毕业,后
  • 水晶奖水晶奖可能是以下奖项之一:
  • 半韵半韵是由发音相似但不相同的文字组成的一种韵。在大多数情况下,两句句子的元音不同,而辅音相同,反之亦然。半韵常常在说唱音乐中使用。使用半韵可以给歌词的创作带来更大的自由
  • 2007-08球季英格兰足总杯2007/08球季英格兰足总杯(英语:FA Cup),是第127届英格兰足总杯,今届赛事的冠军是朴茨茅斯,他们在决赛以1:0击败英冠球队卡迪夫城,夺得冠军。
  • 大道奈绪大道奈绪(1977年2月17日-),台湾新闻主播、记者、主持人,目前为年代新闻台整点新闻主播。大道奈绪是道地的台湾人,因为她8岁时母亲改嫁日本人,才改从继父姓。约2003年投入新闻圈,原于
  • RE引擎RE引擎(英文:RE ENGINE)是由卡普空为第八世代游戏机与第九世代游戏机开发的游戏引擎。RE引擎的开发是从2015年4月和游戏项目同步起跑,耗时一年半开发,可说是配合《生化危机7》所
  • 塔尼特塔尼特(布匿语:;拉丁语:Tanit)是古迦太基的一位女神。塔尼特的信仰发源于地中海西部,从马耳他至加的斯。迦太基继承了这个信仰之后,她被等同于腓尼基神话里的月神阿斯塔蒂。前5世纪