mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
25 lines
391 B
Zig
25 lines
391 B
Zig
|
pub fn main() void {
|
||
|
foo() catch print();
|
||
|
}
|
||
|
|
||
|
fn foo() anyerror!void {
|
||
|
return error.Test;
|
||
|
}
|
||
|
|
||
|
fn print() void {
|
||
|
asm volatile ("svc #0"
|
||
|
:
|
||
|
: [number] "{r7}" (4),
|
||
|
[arg1] "{r0}" (1),
|
||
|
[arg2] "{r1}" (@ptrToInt("Hello, World!\n")),
|
||
|
[arg3] "{r2}" ("Hello, World!\n".len),
|
||
|
: "memory"
|
||
|
);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
// run
|
||
|
//
|
||
|
// Hello, World!
|
||
|
//
|