-
Notifications
You must be signed in to change notification settings - Fork 6
Disallow sloppy calls to functions that allocate memory when they shouldn't. #383
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
base: develop
Are you sure you want to change the base?
Conversation
|
Let's prioritize the 0.99.2 release. This PR requires a little more thought. Also, it would be good to refactor |
pelesh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions on error messaging. In principle, I would tell users what (generic) procedure has faild/was called in error rather than specifying a cryptic variable name. We could use __line__ and __func__ to provide a location of the error in the code.
| assert(res_ != nullptr && "resetSystem should be called after setSystem"); | ||
| A_ = A; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not touch this file for now. It needs more refactoring than this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change is very simple and is better than what we have currently. We can debate the error message, but the user should not be allowed to reset the system without first setting it.
|
Thanks for the suggestions. I will implement them locally because they touch more than the comments (make sure there are no typos in variable names for example) and push them. The one exception is the suggestion I disagreed with explicitly. |
8e1ae60 to
e6822bb
Compare
Description
Memory allocation can be incidental in ReSolve rather than explicitly defined by the user. Multiple calls to functions that should only be called once, or calls to function without first calling a prerequisite function are allowed. Addresses (no commitment that it fully closes) #295 and #19. I'd like your opinion on whether you think it closes these issues. Currently the code allows the user to set a vector to a constant without allocating it. I am ambivalent, but I do think it should be allowed over all. Let me know your thoughts.
Proposed changes
Fixed typos, removed the ability to sloppy synch or sloppily call functions out of order.
Checklist
Put an
xin the boxes that apply. You can also fill these out after creatingthe PR. If you're unsure about any of them, don't hesitate to ask. We're here
to help! This is simply a reminder of what we are going to look for before
merging your code.
-Wall -Wpedantic -Wconversion -Wextra.