$ whois zig
Zig
first released in 2016 · by Andrew Kelley
$ guessprog --inspect zig
- year
- 2016
- paradigm
- procedural
- family
- c like
- memory
- manual
- binding
- static
- safety
- strong
ZIG(7)
- AUTHORS
- Andrew Kelley
- HISTORY
- Andrew Kelley started Zig as a side project and announced it publicly in 2016, aiming for a simpler, more robust alternative to C. Zig has no hidden control flow, no hidden memory allocations and no preprocessor or macros; instead, ordinary Zig code can run at compile time thanks to the comptime keyword, which also provides generics. Its toolchain can compile C and C++ code too, and "zig cc" is often used as a convenient cross-compiler. The non-profit Zig Software Foundation was set up in 2020 to support its development.
- USAGE
- A young language that has not yet reached version 1.0, but has an enthusiastic and growing community. It is used in production by projects such as the Bun JavaScript runtime, the TigerBeetle database and the Ghostty terminal emulator.
- SEE ALSO
- Zig on Wikipedia ↗
const std = @import("std");
fn Stack(comptime T: type, comptime size: usize) type {
return struct {
items: [size]T = undefined,
len: usize = 0,
fn push(self: *@This(), item: T) void {
self.items[self.len] = item;
self.len += 1;
}
};
}
pub fn main() void {
var s = Stack(u8, 4){};
s.push(42);
std.debug.print("{d} item(s), top={d}\n", .{ s.len, s.items[0] });
}