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
C++11: Improve exception safety with smart pointers #1191
Comments
We use C++98. |
|
I think it's more important to keep it simple, so it's not worth to introduce smart pointer, and SrsAutoFree works well right now. SrsAutoFree is a simple, stupid pointer manager, it simply free object in this scope. In fact, SrsAutoFree really works well in SRS. |
The software could become safer and more efficient if a recent C++ version would be applied, couldn't it? |
I think the basic OOAP features are ok to use, like inherit, consturctor, destructor, virtual function, STL. I know and I used template and multiple inheritance in past years, these new features confused many people, and I think it's more simple and easy to understand when we only use basic OOAP features. So, I insist to use C++98 and no C++11 or advanced OOAP features. |
I find your change resistance questionable in this case. |
After 2 years, looking at this issue again, SRS now also supports the C++11 compilation options. Has your opinion on this changed? No, I still firmly believe that if we can use C++98, we should definitely not use C++11. The more complex language features we use, the smaller the target audience of developers becomes. Even the senior brother finds C++98 too complicated, let alone C++11. I hope all C programmers can easily modify the code of SRS. In fact, SRS only used a portion of the functionality of C++98.
Why should SRS 4.0 support C++11 compilation options? The main reason is to support RTC. Some WebRTC algorithms that need to be ported are written in C++11 or even C++14. It would be unnecessary to rewrite the WebRTC algorithms, right? In addition, I found it inconvenient to have to inherit an interface every time for coroutine functions. If we want to start coroutines more conveniently, using C++11 lambdas might be a better option. However, the benefits of this need to be evaluated, as it would only be introduced if it is clearly convenient. From my own technical background, those familiar with C would think that SRS should be degraded to C, while experienced C++ programmers would use 98. The new generation of C++ programmers who are accustomed to 11 would consider it necessary. In reality, programming languages have always been a matter of faith, as belief comes with a cost. The philosophy of SRS is practicality, because practicality leads to simplicity. Don't bother with useless things, just use whatever is simple and easy to use. Simplicity and practicality should not be biased by beliefs. Let the code speak and prove how it can be done better, whether it is truly good or not, everyone can see it.
|
Just thought of this issue and found out that there is already an issue for it. Personally, I think modern C++ starts from C++11 (generally speaking, C++11 should include C++14, I forgot where I read it, C++14 is just a supplement to C++11), which can be considered as a redefinition of C++. SRS should keep up with the trend, of course, this is just my opinion as a C++ beginner, developers may consider more about product promotion and the prosperity of the open-source community. I completely understand and agree with the author's viewpoint, but personally, I hope SRS can move towards Modern C++.
|
Would you like to wrap any pointer data members with the class template “std::unique_ptr”?
TRANS_BY_GPT3
The text was updated successfully, but these errors were encountered: