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

Do we want "free" to remain as a public function? #4

Closed
lemire opened this issue Sep 20, 2018 · 1 comment
Closed

Do we want "free" to remain as a public function? #4

lemire opened this issue Sep 20, 2018 · 1 comment

Comments

@lemire
Copy link
Contributor

lemire commented Sep 20, 2018

What happens if the user calls "free" and then the object goes out of scope? Do you get two frees on the same pointer?

One way around that is to set the pointer to NULL as part of the free function. However, one should then document that the class is unsafe from that point forward (which might be fine if it is documented).

@piotte13
Copy link
Owner

Good point.
Setting the pointer to NULL as part of the free function could work, although I believe the end user should not be aware of the memory management since this is a swift version and we have a fantastic garbage collector!
For this reason, the "free" function will be set to private!

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

2 participants