Zig (programming language): Difference between revisions

Content deleted Content added
No edit summary
Line 99:
 
==Compiler==
Zig is not just a new language: it also includes a C and C++ compilerscompiler, and can be used with either or both languages by leveraging with the commands <code>zig cc</code> and <code>zig c++</code>,<ref>{{Cite web|url=https://ziglang.org/download/0.6.0/release-notes.html#zig-cc|title=0.6.0 Release Notes|website=Ziglang.org|access-date=2020-04-19}}</ref> providing many headers including the [[C standard library]] (libc) and [[C++ Standard Library]] (libcxx) for many different platforms. This allows Zig’s <code>cc</code> and <code>c++</code> sub-commands to act as [[cross compiler]]s out of the box (similarly to [[Clang]]).<ref>{{Cite web|title='zig cc': a Powerful Drop-In Replacement for GCC/Clang - Andrew Kelley|url=https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html|access-date=2021-05-28|website=andrewkelley.me}}</ref><ref>{{Cite web|title=Zig Makes Go Cross Compilation Just Work|url=https://dev.to/kristoff/zig-makes-go-cross-compilation-just-work-29ho|access-date=2021-05-28|website=DEV Community|date=24 January 2021 |language=en}}</ref>
 
Zig treats cross-compiling as a first-class use-case of the language.<ref name=zig /> This means any Zig compiler can compile runnable binaries for any of its target platforms, of which there are dozens. These include not only widely-used modern systems like [[ARM architecture family|ARM]] and [[x86-64]], but also [[PowerPC]], [[SPARC]], [[MIPS architecture|MIPS]], [[RISC-V]] and even the IBM [[z/Architecture]]s (S390). The toolchain can compile to any of these targets without installing additional software, all the needed support is in the basic system.<ref name=zigo/> The experimental support is also provided for less known platforms like AMD and Nvidia GPUs or PlayStation 4 and 5 (with various degree of support).