C++ is still plenty viable, but if you like avoiding bugs, John Carmack seems to have come to the conclusion that using a functional style (which is not exactly <i>encouraged</i> by C++) is advantageous: <a href="http://gamasutra.com/view/news/169296/Indepth_Functional_programming_in_C.php" rel="nofollow">http://gamasutra.com/view/news/169296/Indepth_Functional_pro...</a><p>"My pragmatic summary: A large fraction of the flaws in software development are due to programmers not fully understanding all the possible states their code may execute in. In a multithreaded environment, the lack of understanding and the resulting problems are greatly amplified, almost to the point of panic if you are paying attention. Programming in a functional style makes the state presented to your code explicit, which makes it much easier to reason about, and, in a completely pure system, makes thread race conditions impossible.<p>"No matter what language you work in, programming in a functional style provides benefits. You should do it whenever it is convenient, and you should think hard about the decision when it isn't convenient."
C++ is still a fantastic language. It's hard to learn to use it effectively but once you do you have one of the most powerful programming tools available under your belt. The two main points to using C++ effectively are 1. you must protect allocated resources with smart pointers and 2. threads should only be used to exercise multiple CPU cores and never as a way to work around blocking IO.<p>That later point is a little more complicated/subtle and took me years of threaded programming to learn and accept. When adhering to these two rules, C++ is safe and extremely powerful.
I had this to say about c++/go recently:<p>Working on a c++ project: I feel stupid... and nothing works.<p>Working on a golang project: go is stupid... but everything works.<p>My issue with c++ is someone needs to write a "c++: the good parts" I may end up with rust, but right now I look at the documentation and some rust code and it's a bit overwhelming.<p>Go may be stupid in a lot of ways, but for the most part it's pretty obvious how to accomplish something.
Summarising how I usually seeing these discussions go:<p>The usual argument goes that C++ is bad because of the problems of C.<p>The counter-argument is that "nobody does that in modern C++".<p>The counter-counter argument is that:<p>1. there's a <i>lot</i> more not-modern-C++ than there is modern C++.<p>2. there seem to be dozens of not-really-smoothly-interchangeable notions of what "modern C++" is, because the language is so vast, and there have in fact been several overlapping generations of "modern C++".<p>3. It still requires conscious and vigilant effort, over and above the baseline the language gives you, to not introduce game-over security or reliability flaws.<p>The counter-counter-counter argument is that these are true of every language.<p>Which, being not strictly and completely true in the particulars, is where the whole thing degenerates into personal reflections about $PET_LANGUAGE, hair-pulling, personal insults, blog posts about monads at twenty paces etc etc.
While I admire the amount of thinking that went and still goes into C++, for me the question is opposite: why ever C++? It seems to me that trying to improve a language by ecosystem or convention will always be worse than using a language already designed around what we have learned and what has changed since C++ was born.<p>If somebody <i>really</i> needs to have the performace or be that close to the hardware, they can still probably find a better language today (Rust, Go?). But all others will certainly be better served by more modern, higher level languages. Just reading the examples in the PDF makes my head hurt.
The only thing that has always been behind, and might still be for a couple of years, is the include system, which causes huge delays when compiling and linking, even when editing one single file.<p>When I make edits and hit build, the old C include system kicks in and it's a very long process. I'm using C++ but precompiled headers are not a standard (many details will prevent you to use them) and there are not decent ways to reduce build time to bearable ranges.<p>I'm sure this is the main point that makes C++ so unattractive. If you're a programmer, having shorter code-write/build/test/repeat cycles is important if you don't want to lose focus on what you're doing. I don't know if build delays are specific to C++ or specific to microsoft, but if modules were available in some beta form I would try them ASAP. Even platform specific techniques would interest me...<p>So yes, I'll love C++, but not only the ABI and build configs are not easily solved by CMake, but build times will never make C++ attractive enough. It's not not realistic to pretend you can be really productive with C++.
Site is down so I cant comment on content from the article.<p>As a working programmer here are some things that I consider to be C++ virtues<p>a. Control over memory layout<p>b. Control over allocation policies<p>c. Deterministic deallocation of objects on scope exit<p>d. Generics and specialization of generics<p>I am always mystified how many languages miss out on item a.
I clicked the title and it provided a great answer. something about mysql not connecting. i thought it answered the question until i googled it. a better title would be 'why not php'.