Tag
This article discusses a fundamental memory safety challenge involving tagged unions where a pointer to one variant is used after the union is overwritten with a different variant, leading to type confusion. The author also argues that buffer overflows are the most exploitable memory error and could have been mitigated with better array syntax.
This article explores using Zig's comptime to create tagged union subsets, inspired by Mitchell Hashimoto's work, and applies the technique to a MyST parser's AST traversal.
Mitchell Hashimoto demonstrates how to use Zig's comptime to create subset types of tagged unions, enabling compile-time safety without exhaustive case handling.