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

Remove unnecessary null pointer checks #1107

Closed
elfring opened this issue Apr 4, 2014 · 6 comments

Comments

Projects
None yet
2 participants
@hkaiser

This comment has been minimized.

Copy link
Member

commented Apr 5, 2014

Feel free to provide us with a patch. I'd gladly apply it.

@hkaiser hkaiser added this to the 0.9.9 milestone Apr 5, 2014

@elfring

This comment has been minimized.

Copy link
Contributor Author

commented Apr 6, 2014

How do you think about to clarify another implementation detail for the class "disposer"?

I would interpret the function "operator()" in the way that an input parameter is set to the value "nullptr". I find that this kind of assignment would only make sense if the data type for this parameter will be a reference to a pointer.

@hkaiser

This comment has been minimized.

Copy link
Member

commented Apr 6, 2014

You're right, this code does not make any sense as it is. A reference would be more appropriate..

@elfring

This comment has been minimized.

Copy link
Contributor Author

commented Apr 6, 2014

Are the suggested small cleanup of pointer checks and a data type change for a parameter open issues which should be improved separately?

@hkaiser

This comment has been minimized.

Copy link
Member

commented Apr 6, 2014

I'd be fine with having those in the same patch.

elfring added a commit to elfring/hpx that referenced this issue Apr 7, 2014

Bug STEllAR-GROUP#1107: Removed unnecessary null pointer checks
Explicit null pointer checks were performed at a few source code places
before pointers were passed to the C++ delete operator. This was unnecessary
because the delete operator will care for such parameter validation already.
http://www.parashift.com/c++-faq/delete-handles-null.html

Redundant checks were removed.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
@hkaiser

This comment has been minimized.

Copy link
Member

commented Apr 8, 2014

That's fixed now

@hkaiser hkaiser closed this Apr 8, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.