▲ | digitalPhonix 5 days ago | |
> However if I may raise my counter point I like to have a rule that C++ should be written mostly as if you were writing C as much as possible until you need some of it's additional features and complexities. How do you define “need” for extra features? C and C++ can fundamentally both do the same thing so if you’re going to write C style C++, why not just write C and avoid all of C++’s foot guns? | ||
▲ | bregma 4 days ago | parent | next [-] | |
RAII. It's the major C++ feature I miss in C, and the one that fixes most memory leak problems in C. Also, std::vector, which solves the remaining memory leak (and most bounds problems) in C. And std::string, which solves the remaining memory leak problems. | ||
▲ | dayvster 5 days ago | parent | prev [-] | |
Excellent question, I guess it depends on the team mostly how they define which features they need and which are better avoided. As for why not just go for C. You can write C++ fully as if it were C, you can not ever turn C into C++ |