This post explores some unexpected usages of Zig's defer statement, including asserting post conditions, statically enforcing absence of errors, logging errors, and using defer as a post increment operation.

3m read timeFrom matklad.github.io
Post cover image
Table of contents
Asserting Post ConditionsStatically Enforcing Absence of ErrorsLogging ErrorsPost Increment

Sort: