Skip to content
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

UnPack should not return a bare pointer [C++] #8405

Open
DaveBrantonCTCT opened this issue Sep 27, 2024 · 0 comments
Open

UnPack should not return a bare pointer [C++] #8405

DaveBrantonCTCT opened this issue Sep 27, 2024 · 0 comments

Comments

@DaveBrantonCTCT
Copy link

In the generated code for UnPack, a unique_ptr is used internally - which was done in #5761 to prevent a leak in an OOM condition.

However, the signature of the function still returns a bare pointer. Perhaps this was left as-is for compatibility reasons, but this code would be much better if it returned the unique_ptr instead.

If the compatibility break would be too onerous for C++ users, then this behaviour could be behind a commandline option. I personally doubt this in any case since modern C++ code should immediately wrap this return value in a smart pointer, which would still compile with the change.

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

1 participant