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 #5

Closed
elfring opened this issue Apr 11, 2020 · 3 comments
Closed

Remove unnecessary null pointer checks #5

elfring opened this issue Apr 11, 2020 · 3 comments

Comments

@elfring
Copy link

elfring commented Apr 11, 2020

An extra null pointer check is not needed in functions like the following.

@DavidXanatos
Copy link
Member

meh... you cave a comparison but than you assign a null pointer null again and have a unnecessary call to free.
if we know that statistically the variables are mostly == 0 than yea that would optimize things, but currently idk. so without the comparison we may end up with waiting more CPU cycles in the end.

Anyhow such minor optimizations are something for much later imho.

@elfring
Copy link
Author

elfring commented Apr 11, 2020

  • Which distribution would you expect (or actually observe) for the passing of null pointers?
  • Should pointers for valid objects be usually handled more often?

How do you think about to use a development tool like “clang-tidy” for corresponding source code adjustments?

@DavidXanatos
Copy link
Member

I never payed attention to that so idk.

DavidXanatos pushed a commit that referenced this issue Dec 29, 2020
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