Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am woodywood117 on github.
  • I am woodywood117 (https://keybase.io/woodywood117) on keybase.
  • I have a public key ASBrzMZFKlwdWaiRsR-PduXMr7o9mY-egtmWSKh4dl-mKAo

To claim this, I am signing this object:

@NilPtrDeref
NilPtrDeref / comptime-check.zig
Created May 31, 2024 02:31
Experiment on zig compile-time checks (Conditional code in debug mode)
// Results from `https://godbolt.org/` with Zig 0.12.0 compiler.
const std = @import("std");
const builtin = @import("builtin");
// Check happens at comptime
export fn t1() void {
comptime var dbg: bool = false;
dbg = builtin.mode != std.builtin.Mode.Debug;
if (dbg) {