(Replace XXX with Rust, Swift, Java, Ruby, …)
Image: Bjarne Stroustrup, creator of C++, relaxing in his office. And he should be.
Accept reality: C++ is king. This post is about some of my (humble) reasons why.
C++ forms a base layer close enough to bare metal and provide the high level mechanisms to build up magnificently on top of that with 3rd parties or with your own libraries.
Even glibc (the C library) or libstdc++ (the C++ library) is optional and can be replaced. In our systems, most of the glibc has been replaced by custom versions adapted to the particularities of our applications. This allows us to create sub 100-ns reaction times that are hard to beat even by the most advanced hybrid (FPGA,CUDA,etc) systems.
Complete systems can be built entirely in C++, from top to bottom. With Wx, Qt, even MFC, one can build GUIs and link directly with the bare metal core components. Python, Java, R, Matlab for this sake, have to rely on a base infrastructure built on another language, typically C or C++, for speed. No other language can claim this much breadth.
Even when C++ apparently lacks a single feature, the beauty is that perhaps it is not needed in first place.
C++ lacks garbage collection? Well, perhaps that’s because memory allocations are perhaps one of the biggest performance killers that exist in the digital world. Our trading applications do not need any garbage collection since we manage memory so tightly that allocations are made only once and sporadically a half dozen times at convenient points during the application life time. On the other hand, in languages where GC is mandatory, it becomes a hassle that needs special handling so it stays away from the critical path.
C++ lacks introspection? Well, how many times you need it? If it was integrated into the language, how much of a tradeoff would it be? Still, introspection can be easily built in the language through many distinct mechanisms.
C++ allows you to go places other languages dont.
With mechanisms like custom plugins, some compilers allow you to write additional compiler passes and modify the RTL (Register Transfer Language, a representation of the program in memory as a tree of individual components) on the fly during compilation of the code.
High Level Features
C++11 made C++ look like a completely different language. C++14 and C++17 have continued this path to the point C++ has been completely rejuvenated over the past 10 years.
Segfault is short for segmentation fault.
In computing, a segmentation fault (often shortened to segfault) or access violation is a fault raised by hardware with memory protection, notifying an operating system (OS) about a memory access violation; on x86 computers this is a form of general protection fault. (Wikipedia)
C++ has been bashed for allowing a well intentioned but not-so-sharp technologist to blow up an application by trying to access a part of memory that does not exist. Well, I have been using c++ for over 10 perhaps 15 years and I cant barely remember a single instance of segfault. The question is not about whether one should use C++ but whether that technologist should be looking for a role in sales instead.
Anyone can drive a Ferrari into the ocean and it’s not the Ferrari’s fault if the driver is not the smartest cat in the jungle. Just because it’s possible it does not mean it is likely. A commuter train is not automatically better than a Ferrari just because it does not allow its passengers to make stupid mistakes.
In the end, the test of time.
C++ has been around for decades. There are multiple commercial grade compilers that are so good I have stopped writing assembly code when the compilers started beating up my handwritten assembly routines.
GCC, Clang/LLVM, Intel Icc among many others are sophisticated pieces of engineering that take advantage of every piece of optimization available in each of the platforms it supports.
This article is more of a brainstorm than it is a comprehensive evaluation of the multiple language choices currently out there. At our firm, we are far from language fundamentalists: we are engineers used to put in place systems using whatever tools necessary to complete the job in the most economic way possible.
However C++ is our darling for one big reason: it gets the job done every time.
EDIT: I’ve since deleted a few comments from this post. I welcome and value your point of view but I have zero tolerance for lack of upbringing. Please be considerate to my readers. We are all humans after all and all this technology will be replaced by quantum logic in fifty years anyway.