Skip to content

Commit 535a153

Browse files
committed
Proper way to do a custom panic handler
Ref: https://ziglang.org/documentation/0.15.1/#Panic-Handler
1 parent de3cfd8 commit 535a153

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/apps/zapps/hello.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
const std = @import("std");
2-
const builtin = std.builtin;
32
const cm = @cImport({
43
@cInclude("cm.h");
54
});
5+
pub const panic = std.debug.FullPanic(crash);
66

77
const text = "Test application";
88

9-
pub fn panic(_: []const u8, _: ?*builtin.StackTrace, _: ?usize) noreturn {
9+
fn crash(_: []const u8, _: ?usize) noreturn {
1010
cm.cm_process_abort(cm.CM_ABORT_EXIT_CODE);
1111
while(true) {}
1212
}

0 commit comments

Comments
 (0)