-
Notifications
You must be signed in to change notification settings - Fork 57
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 #163
Comments
Maybe not required, but does not mean any problem/performance hit either. On the other hand, it clarifies what actually happens (that the pointer might actually be null). |
💭 Would you become interested to use a development tool like “clang-tidy” for corresponding source code adjustments? |
Not sure why I would; you did not even reflect to my comment. Things that work don't need fixing. And readability is a subjective matter. |
💭 Would you like to take the C++ guideline “R.11: Avoid calling new and delete explicitly” better into account? |
As you may see, this code is intended to be used in a C environment, not C++, so the above reference is out of context. Raw pointer usage is unavoidable here. On the other hand, your answers sound like that of a bot. Are you a bot? |
👀 Some
💭 Mentioned implementation details can be adjusted.
No. |
Given that raw pointers are unavoidable due to C environment, delete/free statement is also necessary, smart pointers cannot be used here, at least I cannot see another way. |
👀 I got an opposite impression for C++ source code which is generally improvable.
💭 Your temporary view might be too limited. |
If you have a proposal for improving it, let me know (by code examples). |
Known development tools can remind (interested programmers and reviewers) on possible code improvements already. 🤔 |
But I want to know if you can propose an improvement. Whether you can participate in this discussion constructively and cooperatively. You haven't convinced me that you are not a bot. |
I obviously did that for various software components. 💭 I hope that development interests will grow for reported change possibilities.
How much does such an enquiry matter for this issue? 🤔 |
It shows me why this discussion is not constructive, and does not lead anywhere. Maybe that is why you cannot propose an improvement relevant to this piece of code, with code examples, only point to generic rules and principles. |
💭
|
If I may interject, @elfring if you're gonna rework code that isn't really broken, you might as well suggest more comprehensive improvements for a reworked/modernized release rather than suggesting a seemingly random isolated change that's probably one of the more uninteresting ones in the first place. E.g., assuming at least C++11 and C99, you would probably change
to
Anyway, I'm not sure why you are focusing on this specific
which could possibly be turned into:
changing:
More importantly though, the use of Also, the |
An extra null pointer check is not needed in functions like the following.
The text was updated successfully, but these errors were encountered: