-
Notifications
You must be signed in to change notification settings - Fork 23
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
[WIP] Modernization/migrate to smart pointers #49
base: master
Are you sure you want to change the base?
[WIP] Modernization/migrate to smart pointers #49
Conversation
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.
Thanks Sean. Definitely keen to move adler to smart pointers but I had some thoughts on the overall approach. Some comments made which describe those.
Happy to tackle when you've had a chance to rebase/merge of course.
/** | ||
* The destructor. | ||
*/ | ||
~memory_walker_adler16() override = default; | ||
|
||
private: |
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.
This inclusion of private here is intentional. The idea is that the headers are written from a template and in a very structured way. Rather than mysteriously move the constructor to the bottom of the header, it's left in the usual spot as a prompt (to the lib user especially) that the create method should be used.
/** | ||
* The destructor. | ||
*/ | ||
~memory_walker_adler32() override = default; | ||
|
||
private: |
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.
This is intentional, same as in adler16.h above.
@@ -56,8 +56,8 @@ srecord::input_filter_message_adler32::process(const memory &input, | |||
// lowest address to highest. (Holes are ignored, not filled, | |||
// warning issued already.) | |||
// | |||
memory_walker_adler32::pointer w = | |||
memory_walker_adler32::create(); | |||
auto w = std::make_shared<memory_walker_adler32>(); |
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.
Definitely keen to move to smart pointers. I should have picked these up when I moved from boost to std share pointers elsewhere.
However, I'd rather move the creation of the smart pointer into the create method in the class(es). My worry is that someone using libsrecord won't get the benefit or more importantly may mix smart and non-smart pointers if they are using base and library code from the project.
Hi Sean. Apologies for falling behind but did you still want to move forward with this one? |
I have been a little busy with life events recently. Will be coming back to this in a couple weeks. |
Completely understand. Nothing but empathy from me on that one. I hope all is well. |
Blocked by PR #48
Start migrating code when applicable to:
Goal is to reduce call of new/delete within source code.
To help validate a branch utilizing Valgrind was created. Cherry pick commit as needed for testing.