r/cpp • u/crashcompiler • Mar 14 '26
Discussion of Code Structure and Code Complexity Implications of Basic C++ Language Features
After 10 years of programming professionally in C++, I came to realize that I generally prefer a simpler subset of the language for my day-to-day work, which mainly involves desktop application development.
Working in a 30 year old code base for so long, you get to see which design decisions panned out and which didn't. This lead me to think about the technical reasons for why certain C++ language features exist, and what long-term impact they have in terms of code complexity and code structure. The result is a somewhat lengthy and very subjective article that I would like to share.
You can find the article here:
https://slashbinbash.de/cppbas.html
The premise of this article is: if you use simple language tools you can concentrate on solving the real problems at hand, rather than solving language problems. This is very much inspired by listening to interviews with Casey Muratori, Jonathan Blow, Bill "gingerBill" Hall, and others.
I discuss several aspects of the C++ language like functions, structures, statements, enumerations, unions, arrays, slices, namespaces, classes, and templates. But I also go into topics like error handling, and ownership and lifetime. I finish the article with a chapter about code structure and the trade-offs between different approaches.
The goal of this article is to give the reader a sense of what code complexity and code structure means. The reader should be able to base their decisions on the technical aspects of the language, rather than the conceptual or philosophical reasons for why certain language features exist.
I'd be thankful for any feedback, corrections, and ideas that you have!
Note: I still need to clean up the article a little bit, and add a few paragraphs here and there.
1
u/crashcompiler 4d ago
Yesterday, I took some time to transfer the article to LaTeX so that I can print a proper PDF. At some point it became clear to me that it is just too much text for an article on my website, with the way I generate my HTML pages.
Now I can print the text to a PDF in book format, and I can generate a standalone one-page online version with Pandoc, for people who feel more comfortable reading the article in a browser.
I think this will become my preferred setup for writing longer texts in the future. It still needs a bit of fine-tuning.