Bloggers, influencers, and the C++ Standard Committee actively advocate for the use of Modern C++. Through articles, tutorials, and social media, bloggers and influencers highlight the benefits and innovative features of the latest C++ standards, aiming to educate and inspire the programming community. Their collective efforts are geared towards encouraging developers to adopt Modern C++, leveraging its advanced capabilities to write more efficient, maintainable, and robust code.
However, not all C++ developers agree with adopting Modern C++ for various reasons, leading to the emergence of the Orthodox C++ approach, which advocates for using a minimal subset of C++.
Orthodox C++, as defined by its fans
Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It’s exactly opposite of what Modern C++ suppose to be.
To resume, Orthodox C++ fans are adopters of the C++ presented by Bjarne Stroustrap 40 years ago:
Here are some projects sample of the Orthodox C++ approach:
- DOOM 3 BFG
- Qt (when built with no-rtti, no-exceptions)
- dear imgui
- bgfx
- TheForge
- Oryol
- Network Next SDK
Orthodox C++ prefered rules:
- C-like C++ is good start, if code doesn’t require more complexity don’t add unnecessary C++ complexities. In general case code should be readable to anyone who is familiar with C language.
- Don’t do this, the end of “design rationale” in Orthodox C++ should be immedately after “Quite simple, and it is usable. EOF“.
- Don’t use exceptions.
- Don’t use RTTI.
- Don’t use C++ runtime wrapper for C runtime includes (
<cstdio>
,<cmath>
, etc.), use C runtime instead (<stdio.h>
,<math.h>
, etc.) - Don’t use stream (
<iostream>
,<stringstream>
, etc.), use printf style functions instead. - Don’t use anything from STL that allocates memory.
- Don’t use metaprogramming excessively for academic masturbation. Use it in moderation, only where necessary, and where it reduces code complexity.
As we can see, proponents of Orthodox C++ advocate for using a minimal subset of C++, but web resources indicate that they are in the minority. Indeed, the majority supports the use of Modern C++. However, when it comes to the broader C++ developer community, the question remains: are most developers actively using modern C++ features, or do they primarily rely on basic C++ concepts?
We can’t have a precise answer to this, but it is clear that many projects still adhere to the Orthodox C++ approach due to their legacy codebases. This often prevents developers from transitioning to Modern C++, resulting in a continued emphasis on basic C++ concepts.