-
Notifications
You must be signed in to change notification settings - Fork 7
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
Should nlopt_opt be finalized? #11
Comments
Actually, the Line 146 in 696b0e2
The Lines 239 to 243 in 696b0e2
The rationale for having both is that it can be inconvenient to not have a way to manually destroy an object and require it to go out of scope for proper finalization (either by using |
Right, I missed that, sorry. I was only looking at the example in the readme. I fully agree with your reasoning. |
Maybe we could update the documentation for this and add a code comment in the example? However, I think that this example might be a bit special, because we are in a |
By documentation do you mean the Readme? If so, I can I create a PR. Yes, the explicit destruction in the main program scope is a good rule to avoid the false positive when using an application like valgrind. My question was motivated by my two recent threads:
An artificial example for the auto-finalization in the associate statement, would be a constraint object with a pointer component, that was created using the default structure-constructor directly in the associate statement, instead of declaring at as a (static) target in the main program scope. |
I'm interested in the rationale behind preserving explicit destruction of the optimization object instance instead of wrapping this within a finalizer.
I can see a few reasons why'd you keep this as the user's responsibility, primarily to avoid dealing with the odd behavior prescribed by the Fortran standard.
The text was updated successfully, but these errors were encountered: