Second, C++ is popular by pretty much every measure I could think of. Whether you want to measure lines of code, or number of projects, or number of developers - it is very high on the list.
It is true that is not popular with web developers and gets shouted down in those echo chambers, but the web entirely runs on C++ because all browsers are written in C++.
Of course, I can install any compiler, but my employer might not allow me to use it. Porting to a new compiler is not an easy task when a code base is large; we postponed porting due to lack of time.
> Second, C++ is popular by pretty much every measure I could think of. Whether you want to measure lines of code, or number of projects, or number of developers - it is very high on the list.
More interesting measure would be the number of new projects.
> It is true that is not popular with web developers and gets shouted down in those echo chambers, but the web entirely runs on C++ because all browsers are written in C++.
In web backend C++ is not used. You find there C#, Java, PHP, Python, maybe Go.
Every now and then, I integrate a native library into our Java and .NET projects.
A significant amount of code for Google/Amazon is Java and Microsoft uses C# for a lot of infrastructure.
Not entirely true - Firefox is rewriting some components in Rust. They already included the first Rust code in Firefox 48, and Firefox 53 will require Rust to compile.
[0]: https://gist.github.com/mattico/a5e5f9d58a3991d0e3e844e97fa0...
That is, preliminary WebRender has landed, but is being done incrementally, so the gains aren't big yet due to some copying that won't be necessary in the long run.
You're totally right that it's just a start. This stuff takes time!
So it might not be popular, but any alternative, currently, means more work due to FFI layers, less tooling support regarding IDEs and debugging infrastructure.
We should support those more modern alternatives, however also be realistic that only in the last five years or so, many companies have started to move from C into C++ (e.g. BMW, Sony,...), and they will take a few decades to switch to something else.
I am glad I do not have to deal with C++, for the very reasons you mention, but as far as I can tell, it is fairly popular already.
C++ is still popular because there are a lot of existing projects; nobody would throw away their products. Many things were standardized too late, like threads or strings. Lack of standard solutions had led to produce custom ones, often proprietary. Nobody would rewrite working-for-years subsystem just because C++ finally learnt what a thread is. Another example is variety of incompatible build systems; I wish C++ had something similar to PyPi or CPAN (I even don't dream about Go-like import system). Not to mention incompatible compilers, but I must admit there is a progress.
C++ has many substantial problems and when I see that the committee wasting time on such unimportant things, like a 2D graphics library, it makes me upset.
The goal is not to replace SDL, rather provide a portable way of doing basic 2D graphics.
The C culture of leaving the libraries to the OS was one of the reasons why C++ got a chaos of interoperability issues, letting other languages that understood how that is relevant to gain mindshare in the late 90's.
C++ needs its batteries.
The truth is that it just wouldn't otherwise get done. Maybe twenty years from now there will be committees working on separate modules and we'll download those if desired.
So lets remove stdio and iostreams from the standard, shall we?! Just for the sake of keeping the standard pure.
A language goes hand in hand with its libraries, failure to understand that just leads to oblivion.
One of the reasons C++ has done so well is that it sticks to its area of competence and doesn't try to do everything for you.
C++ is almost gone from the GUI space, that is how well it has done.
The GUIs from desktop and mobile OSes have moved into other languages, leaving C++'s the role of just talking to the GPU and little else.
In addition to the obvious performance improvements this would give compilers, this really cuts down on the complexity that third-party tools need to deal with to work well with C++ code. The quality of tooling for C++ has historically been stymied by the complexity of analyzing the code itself. Modules are a huge step in the right direction for helping with this.
$ echo "#include <iostream>" > foo.cpp
$ g++ -E foo.cpp | wc
37799 104779 1280834
Including just iostream in a file means the compiler has to process 37799 (!) lines.For comparison, a C file including stdio:
$ echo "#include <stdio.h>" | gcc -E - | wc
456 1638 20880
That still looks bloated to me, but is about 60x times fewer bytes. $ curl https://git.musl-libc.org/cgit/musl/plain/include/stdio.h | wc
203 630 5231...despite claim that the light truck is a general purpose vehicle...people would chose for a new vehicle a bicycle, car, aircraft, motorcycle, or tank...
Use the right tools for the job. C++ is intended to be a general purpose systems programming language. An excellent tool for a wide variety of tasks, but not the be all and end all.
I am right now working on a library built in C++ and although I also have written some utility programs for the system in C++, its main interface is intended to be through (swig-enabled) Python and Common Lisp.
I wrote C++98/03 for years and kind of hated it. I love C++11/14. I've tried Rust and other languages, but C++ is such a good choice these days.
I agree that C++11 was a leap (older C++ was terrible). However, both C++14 and C++17 are just a sets of smaller or bigger improvements.
One of the reasons I found some pleasure writing Java instead of C++, even before it got a JIT, was the portability story.
Writing portable C++ code across the many commercial compilers available back in the days when the only standard was the C++ARM book, wasn't particularly fun.