3 ms·
I don't think I tend to be a passionate anti C++ commenter, though I agree with the sentiment. I've used C++ for around a decade, both professionally and as a
by Rusky 8y ago
I don't think I tend to be a passionate anti C++ commenter, though I agree with the sentiment.
I've used C++ for around a decade, both professionally and as a hobby, in various domains. I use it because I either need (or merely want, in many cases) the control over the resulting end product that it provides.
The grievances are well known, and most are being addressed in some form, so asking random commenters isn't going to change anything.
But for what it's worth: it just feels like the language is a lost cause.
Everything is so irredeemably hard (without breaking back-compat)- from syntax/name resolution/template expansion, and the accompanying problems with error messages and tooling; to build systems and dependency management, and the impossible task of ever getting anything standard there; to memory+thread safety, where every solution is a partial bandaid and there's no light at the end of the tunnel.
It's a big, important, widely-used language. It's just not pleasant to work with- and while that can and will improve, it will always be tied to its rather painful legacy.
- codr4 8y agoSecond most of that. I used to be really passionate about C++ back in the days, but it's just too damn complex. Yes, some new features really help; if I could bring one to a desert island it would be lambdas. Tuning C++ these days is mostly trial and error for me, there are so many gotchas to keep in mind that it's more or less impossible to juggle it all mentally. From my experience there comes a point where the required effort tips the scales towards more convenient languages for most projects. But by the time you realize you're usually up to your neck in template goo that no one wants to translate.
- vvanders 8y agoYeah, +1 to all of that. I spent maybe ~15 years writing C++ over hobby + career timespan. Was a huge proponent of the language but spent the last 2-3 years over in Java land while doing all my greenfield work in Rust. Came back to another lower level project written in C++/0x14 lately and it's a bit of a shock how my things I 'forgot' even on a modern codebase. Things like implicit constructor conversions, the fact that the type inference is pretty weak still(why can't I just construct unique_ptr w/out the type when I pass it direct[1]). Headers and package management is a total mess. At this point unless I've got a hard constraint(like QNX or other yet supported platforms) I'm going to reach for Rust just about every time. [1] Yes I know make_unique() is a thing but it's a C++/0x17 and just patches one part of type inference issues.
- berti 8y agomake_unique and friends are C++14 ;) https://en.cppreference.com/w/cpp/memory/unique_ptr/make_unique https://en.cppreference.com/w/cpp/memory/unique_ptr/make_uni...
- dnautics 8y agoI feel the same way about the the "lost cause" (though I never programmed C++ professionally, I did for science fair projects, and played around, a lot, with the BeOS API back in the day - enough to get RSI): Even JavaScript which kind of felt like a lost cause to me about three years ago has redeemed itself - I was shown a "way to code JavaScript" which exclusively uses ECMA6, keeps very little if no state, and basically everything is a `const fn (...) => {}`. A breath of fresh air in its simplicity and safety. C++ doesn't seem to want to converge to this sort of thing, even as usable subset of the language. I would say the best quality of C++ is that you can be reasonably certain of what the program is doing at the machine language level (though obviously C is better) but this is going to be overtaken by languages like rust, which have more sophisticated type system and unlike VM languages (which definitely have their place) leave safety considerations in the compiler.
- flohofwoe 8y agoSame here. Been writing C++ since around 1998, was somewhat excited about C++11 (which brought a few good things, like lambdas, and ... uhm...). Since then I have the impression that C++ and I are moving into different directions. Since last year I started writing C code again and enjoy it very much, surprisingly I haven't missed C++ at all since then. That's when I realized that all I want/need is a "slightly better C" (Go is pretty close but already too high level, in the sense that there's too much under-the-hood-magic happening).
- merlincorey 8y ago> excited about C++11 (which brought a few good things, like lambdas, and ... uhm...) The auto specifier[0] is frankly the most ergonomic and simple thing which I wish I could have in, say, C. [0] https://en.cppreference.com/w/cpp/language/auto https://en.cppreference.com/w/cpp/language/auto :: auto specifier (since C++11)
- xyzzyz 8y agoThe biggest thing C++11 brought in my opinion is standardizing scoped_ptr. Now there is absolutely no excuse for typing "new" or "delete" in new code (except of some very limited circumstances).
- phao 8y agoYep... The "slightly better C" seems pretty universal as far as I've seen. A lot of people just want that it seems. It's not clear what that would look like though. It's a shame. Have you seen Terra? http://terralang.org/ http://terralang.org/