Key semantics of std.debug.assert

This is completely unrelated to LLVM. Side effects are 100% well-defined in the Zig language.

Examples of Not side effects:

  • calling a function
  • loading from memory
  • storing to memory
  • inline assembly
  • atomics
  • unreachable in unsafe optimization modes
  • everything not in the following list

Complete, exhaustive list of all side effects:

  • loading through a volatile pointer
  • storing through a volatile pointer
  • inline assembly with volatile keyword
  • atomics with volatile pointers
  • calling an extern function
  • @panic, @trap, @breakpoint
  • unreachable in safe optimization modes (equivalent to @panic)
16 Likes