mirror of
https://github.com/ziglang/zig.git
synced 2025-12-25 15:43:06 +00:00
* docs(std.math): elaborate on difference between absCast and absInt * docs(std.rand.Random.weightedIndex): elaborate on likelihood I think this makes it easier to understand. * langref: add small reminder * docs(std.fs.path.extension): brevity * docs(std.bit_set.StaticBitSet): mention the specific types * std.debug.TTY: explain what purpose this struct serves This should also make it clearer that this struct is not supposed to provide unrelated terminal manipulation functionality such as setting the cursor position or something because terminals are complicated and we should keep this struct simple and focused on debugging. * langref(package listing): brevity * langref: explain what exactly `threadlocal` causes to happen * std.array_list: link between swapRemove and orderedRemove Maybe this can serve as a TLDR and make it easier to decide. * PrefetchOptions.locality: clarify docs that this is a range This confused me previously and I thought I can only use either 0 or 3. * fix typos and more * std.builtin.CallingConvention: document some CCs * langref: explain possibly cryptic names I think it helps knowing what exactly these acronyms (@clz and @ctz) and abbreviations (@popCount) mean. * variadic function error: add missing preposition * std.fmt.format docs: nicely hyphenate * help menu: say what to optimize for I think this is slightly more specific than just calling it "optimizations". These are speed optimizations. I used the word "performance" here.
30 lines
846 B
Zig
30 lines
846 B
Zig
extern fn printf([*:0]const u8, ...) c_int;
|
|
|
|
pub export fn entry() void {
|
|
_ = printf("%d %d %d %d\n", 1, 2, 3, 4);
|
|
}
|
|
|
|
pub export fn entry1() void {
|
|
var arr: [2]u8 = undefined;
|
|
_ = printf("%d\n", arr);
|
|
}
|
|
|
|
pub export fn entry2() void {
|
|
_ = printf("%d\n", @as(u48, 2));
|
|
}
|
|
|
|
pub export fn entry3() void {
|
|
_ = printf("%d\n", {});
|
|
}
|
|
|
|
// error
|
|
// backend=stage2
|
|
// target=native
|
|
//
|
|
// :4:33: error: integer and float literals passed to variadic function must be casted to a fixed-size number type
|
|
// :9:24: error: arrays must be passed by reference to variadic function
|
|
// :13:24: error: cannot pass 'u48' to variadic function
|
|
// :13:24: note: only integers with power of two bits are extern compatible
|
|
// :17:24: error: cannot pass 'void' to variadic function
|
|
// :17:24: note: 'void' is a zero bit type; for C 'void' use 'anyopaque'
|