3 ms·
Yeah more features is exactly what C++ needed... Am I the only one who uses C++ as C with classes? Sometimes I use vectors or strings and I like default values
by sprash 10y ago
Yeah more features is exactly what C++ needed...
Am I the only one who uses C++ as C with classes? Sometimes I use vectors or strings and I like default values in functions and other minor improvements to C. I don't want to reimplement the n'th version of string concatenation when I can just use the "+" operator, sure... and there starts the rabbit hole. Before you know it you have a "protected abstract virtual base pure virtual private destructor" and have to explain the new hired mathematician who only has experience in R what the fuck you are doing.
- dom0 10y agoIn a word: C++ is probably not for you(r application).
- AnimalMuppet 10y agoDisagree. C++ has the philosophy of "You don't pay for what you don't use". Just use the parts that help with your problem. If your problem grows and you need more, you aren't trapped - the language has more. But if you don't need it, don't use it. For that matter, I'd argue that this is a reasonable approach for every language.
- rkv 10y agoI completely disagree. C++ was not created to extend or enhance C; its an entirely new language providing backwards compatability only for legacy reasons. Using C in C++ introduces deficiencies and dangers that C++ was designed to overcome. As a C++ developer I come across a lot of code where people still use things like FILE* and close the handle in a goto. That should be frowned upon, there is no advantage for this method vs. using a stream; which handles the file handle while being scope bounded. Promoting the use of C in C++ is something terrible misguided and plain wrong.
- stinos 10y agoAm I the only one who uses C++ as C with classes? I'd say unfortunately not. Focussing on the classes has the disadvantge it can quickly lead to 'everything is an object' or derived strict OOP mindsets thereby not only ignoring tons of other, more functional, goodies modern c++ has to offer but also leading to what you call 'protected abstract virtual base pure virtual private destructor'.
- psyc 10y agoI use C++ mostly like "C with classes" and for me (a low-level game programmer) it's close to ideal. It absolutely baffles me that there is not yet a language that's explicitly a thoughtfully-designed "C with classes".
- GrumpyYoungMan 10y agoNo, you aren't. I've also seen (and done) C++ used as C with classes in embedded systems development, where you really need to be sure that the compiler isn't doing something you don't expect.