Zig finally forces parentheses on ambiguous operator precedence after a 10-year-old proposal

Partial Operator Precedence

Zig has implemented a proposal from 2016 that requires parentheses for ambiguous operator combinations, ending years of confusion over precedence rules. The change affects only rare cases—about 353 lines in the million-line codebase—while common expressions like `x + y * z` remain unchanged. Developers can fix code manually or use `zig fmt --upgrade` to automatically insert parentheses, though manual review is recommended to catch hidden bugs.

No matter how experienced you are with Zig, it’s unlikely that you’d be able to explain the evaluation order of the following expression without looking up the precedence rules: a & b + c * d >> e | f orelse g() catch h + i == j or k and l

More from this day

2026-11-05