C dialects versus C++ dialects
Some developers say that since the C++ programming language is so large, containing lots of features, each C++ programmer ends up writing code in a different subset of C++, a different dialect.
This essay looks at whether the C language - which contains a much smaller set of core features than C++ - is any better with regards to the "dialects problem".
The core language plus the standard library
In C, both the core language and the standard library are small. In C++ it's the reverse, the language comes with "batteries included".
When talking about the "dialects problem" of C++, it targets the core language: since the core language contains advanced features, not everybody has the time and willingness to learn everything about C++.
On the other hand the C++ standard library is seen as a big advantage compared to the very minimal C counterpart.
In fact, with the C language the standard library is usually not sufficient in order to write code comfortably.
The need to use an additional foundational library in C
To develop large-scale pieces of software in C, free software projects and companies have developed - over the years - additional libraries on top of the standard C library, that serve as a more complete foundation.
In the free software world, there are at least a half-dozen of such libraries to choose from:
- GLib: used by GTK, GNOME, some other free desktops, GStreamer, etc.
- ELL (Embedded Linux Library): used by the Wi-Fi daemon iwd.
- APR (Apache Portable Runtime): used e.g. by Apache httpd and Subversion.
- C-Util (Common Utility Libraries for C11): used e.g. by dbus-broker.
- ZeroMQ and CZMQ (High-level C Binding for ZeroMQ).
- What systemd provides, for example sd-bus, sd-event, etc.
The problem is that these additional foundational C libraries are not standard, they widely differ in their APIs.
In C, a lot of things are done through function calls. Depending on the foundational library used, the programming style can vary a lot. So it creates different dialects.
Conclusion and opinion
Here is how I view it: while in C++ the dialects come from the use of different subsets of the core language, in C the dialects come from the use of different supersets of the standard library.
If you know the bases of the C++ core language, and are familiar with the C++ standard library, then the style differs less from one project to another, from one company to another. As a consequence, from the programmer's point of view, it's easier to switch jobs where the primary language is C++; and from the company's point of view, it's potentially easier to hire and train developers.
In C, it's almost like the need to learn completely different stdlibs each time you work in a different community/company.
P.S.: that said, nothing is ever perfect in the software world.
P.P.S.: insert here a few words about Rust.