Skip to content

Compilation error when a function returns local variable address? #13344

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

Closed
dee0xeed opened this issue Oct 29, 2022 · 1 comment
Closed

Compilation error when a function returns local variable address? #13344

dee0xeed opened this issue Oct 29, 2022 · 1 comment

Comments

@dee0xeed
Copy link

Returning a pointer to local variable is a pretty frequent error made by beginner programmers.
Some C compilers (gcc at least) emits a warning in such cases.
It would be nice if Zig could analyze this.

@rohlem
Copy link
Contributor

rohlem commented Oct 29, 2022

Duplicate of #2646 (although that issue's text isn't as direct/specific).

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

No branches or pull requests

3 participants