|
|
|
|
|
by dkrikun
2746 days ago
|
|
People mostly keep saying that:
1. C++ has at least everything C got, and "other features" so it cannot be worse.
2. C++ is safer than C. Regarding 1.:
a. C99 and C++11 have diverged. For example, `struct xx x = {0}` has different meaning in those languages.
b. Lack of certain "features" is an advantage. See, C++ is a huge and complex language (r-values, x-values, exception safety, templates, sfinae and so on and so forth). Yes, you can restrain yourself from using them. But can you restrain others working on your codebase, now and in the future effectively? Good luck writing and maintaining code style guidelines.. 2. Well, yes, by using smart pointers, STL, RAII, C++ is safer than C for small, fresh codebases. But remember: C++ was designed for backward compatibility with C. It's full of undefined behaviour and pointer arithmetics. Be careless once and all the safety is gone, and then it will be harder to debug than plain old C. |
|