05 April 2019
This article started out as a snippet on why I treat C/C++ as a red flag, but it then grew into a mini-discussion about Modern C++ (i.e. C++ specifications 2011 onwards), that I thought best to spin into its own article. I have long had a love-hate attitude towards C++, alternating between liking various features and being repelled by its baggage, but recently have been wondering whether it is of any value to myself professionally. I still have personal interest in the language but I am doubtful it is worth the investment from a professional stand-point given how much it has evolved over the years.
As well as the concrete specifications of any given programmimg language, there is a cultule of both how code should be written (e.g. Pythonic Python) and the type of software projects that the language tends to be used forAs a result various languages have certain amounts of dogma attached to them which influences what they are used for and the background of developers who use them. For instance Python is quite good for low-level protocol work, but professionally that type of thing is in practice only ever done using C. All this indirectly contributes to the languages eco-systems.
C/C++ as language set
Back in the 1990s C++ was not much more than C with classes so back then lumping the two together had some justification. I remember the QualNet network simulator from the mid-2000s that claimed to be C++ but it was really just C code being passed through a C++ compiler. However in the last ten years C++ has had a lot of additions that make it very different to the C++ of the past, let alone straight/traditional C. Although more recent C specifications have undoubtedly been influenced by developments with C++, such as tightening up of what can be left implicit such as omitting function prototypes in some situations, no doubt influenced by, C++ is not (and never has been) a true super-set of C. The issue here is the extent that the skill-set of C and C++ are interchangeable, and these days I think putting C & C++ together is about as valid as putting it together with Java or C# — the only people who do such a thing are non-technical.
The syntax of C & C++ is much the same, but what really matters is experience with the ecosystem such as the standard libraries, and experience with what the languages are normally used for — a rude awakening I got with my first proper job was the extent that productivity was about knowledge of framework features rather than ability to program. Modern C++ include things like threading built-in and there seems to be a trend in companies that use it asking about library features rather than the language itself — I even had an interview with one company that a friend referred me to where they were only interested in experience with Boost. This was when I realised C++ was not for me.
From the perspective of the C coder the big problem with Modern C++ is that it has a very different target audience, namely general-purpose desktop applications, than what C would typically be a candidate for. As a result it treats low-level access to memory pointers are as necessary occasional evil rather than a fundamental part of the language. What I see is C++ going down the road that C# has been before — wanting to do away with things like direct access to pointers but realising it could not, so instead it introduces various contortions that are supposed to make it “safer”. Do stuff like your own memory managment and before long you are not far off C-with-classes rather than modern C++.
In terms of a general language for application programming rather than lower-level systems development, C++ has its attractions compared to the competition. It uses the existing platform-specific deployment models of compiling and then linking in required libraries, rather than having its own run-time ecosystem. In contrast Oracle's licensing shenanigans has killed Java, C# is all but in lip-service a Microsoft-only language, and Python leaves a bit too much error-checking until run-time for my tastes. The STL (Standard Template Library) also looks reasonably lean compared the standard libraries of its main competitors, although it is starting to show signs of bloat.
The problem with C++ as a language in its own right — and if anything it is worse rather than better with Modern C++ — is that it makes some things needlessly difficult. Some of these difficulties are due to having to expose underlying stuff that other languages can abstract over, but if one has already decided to give up low-level access this is needless pain with nothing to show for it. Things that spring to mind are copy constructors and mutators, which have lots of ugly details that other languages sort out for you. However there is one thing with C++ that is still over-complex: Printing output. For formatting text I/O Streams are needlessly verbose compared to format strings, and from memory were likely a secondary reason I stopped using C++ in the early-2000s. Compared to format strings they are simply an utter pain up the arse, and it partly explains why wxWidgets uses its own string class.
C++ is trying to compete with the likes of C#, Python, and Java — languages that come with a lot of stuff built-in and where to varying extent platform-specifics are glossed over. Where Modern C++ becomes a real pain is that it tries to obtain the same safety against memory-related pit-falls as the aforementioned languages while maintaining the low-level access that C grants. Problem is that C++ has a track record of botched specifications and ultimately the likes of Java/Python/C# are simply more intuitive to use.
Overall C++ prospects
For the type of network programming I do professionally C++ has never really bought anything helpful to the table, and the culture that is built around Modern C++ effectively discourages low-level access. However for the use-case of higher-level application programming I think there are other languages that are much cleaner for such development tasks. As with Java I suspect the type of software projects that Modern C++ is chosen for are probably ones I am not interested in as part of my career.