Skip to content

Added documentation for common mistakes in errdefer scoping #10607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 23, 2022

Conversation

Exonorid
Copy link
Contributor

This PR adds a subsection to the Error Union Type section of the documentation to inform readers about common mistakes caused by errdefer scoping (e.g. allocated memory leaving the scope of an errdefer and being leaked) to hopefully save some people from shooting themselves in the foot. In commit e9c7987, I added a header to separate this from the errdefer subsection because I felt it was distinct enough, but it's completely optional imo

This PR is intended to resolve issue #7298

@Vexu Vexu merged commit 91a88a7 into ziglang:master Feb 23, 2022
@andrewrk
Copy link
Member

Reverted in 3ce6de8. This kind of thing does not belong in the language reference.

@linusg
Copy link
Collaborator

linusg commented Nov 27, 2024

#7298 should probably be reopened then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants