mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
backend=auto (now the default if backend is omitted) means to let the compiler pick whatever backend it wants as the default. This is important for platforms where we don't yet have a self-hosted backend, such as loongarch64. Also purge a bunch of redundant target=native.
28 lines
830 B
Zig
28 lines
830 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);
|
|
_ = &arr;
|
|
}
|
|
|
|
pub export fn entry2() void {
|
|
_ = printf("%d\n", @as(u48, 2));
|
|
}
|
|
|
|
pub export fn entry3() void {
|
|
_ = printf("%d\n", {});
|
|
}
|
|
|
|
// error
|
|
//
|
|
// :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
|
|
// :14:24: error: cannot pass 'u48' to variadic function
|
|
// :14:24: note: only integers with 0 or power of two bits are extern compatible
|
|
// :18:24: error: cannot pass 'void' to variadic function
|
|
// :18:24: note: 'void' is a zero bit type; for C 'void' use 'anyopaque'
|