-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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 unneccessary NULL check in srs_freep. v5.0.150, v6.0.38 #3477
Remove unneccessary NULL check in srs_freep. v5.0.150, v6.0.38 #3477
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.
The commit message can be improved.
- How do you think about to omit hyphens from the subject?
- Would you like to refer to a previous suggestion in your change description?
c056094
to
2ac9eb8
Compare
Seems make sense to me, however I wonder if all compiler check the null pointer? |
💭 Would you like to support any compiler versions which would be standard-incompliant in this technical detail?
|
Thanks for your PR. Follow the reference, delete nullptr is safe. https://en.cppreference.com/w/cpp/memory/new/operator_delete And I test it with simple code. #include <iostream>
int main()
{
char* p = NULL;
delete p;
return 0;
} It works well. Then I gdb the program and find the implement of delete in gcc. Obvious, But I still have a question, in other platforms which not use gcc, for example, MSVC of Windows, cause the same result? Can you test it? Thanks. |
How much do you care for standard compliance of applied compiler variants? 🤔
|
PICK b574ad1 Co-authored-by: winlin <winlin@vip.126.com> Co-authored-by: john <hondaxiao@tencent.com>
…#3477) Co-authored-by: winlin <winlin@vip.126.com> Co-authored-by: john <hondaxiao@tencent.com>
Removed the unnecessary NULL pointer checks in trunk/src/core/srs_core.hpp
https://isocpp.org/wiki/faq/freestore-mgmt#delete-handles-null
This is my first Pull Request, So if anything's wrong please tell me