Zig defer and errdefer for deterministic cleanup and error rollback
Zig’s defer and errdefer statements give deterministic scope-exit cleanup and error-only rollback; this guide explains LIFO execution, evaluation timing, and common pitfalls with a file example.