Zig Assert Strategies

This post is about how to express various kinds of assert in Zig. - std.debug.assert is a normal function, and it may evaluate its parameter even in ReleaseFast mode. - All safety-checked illegal behaviour can be dealt with using a custom panic handler. - Use if (@import("builtin").mode == .Debug) when you’re feeling paranoid about slow asserts.