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.
View all comments
Show parent comment
3
u/crashcompiler Mar 14 '26 edited Mar 14 '26
> I'm not sure who the target audience is for this resource.
I have struggled with this question for some time.
As I mentioned in my post, I work at a company with a large C and C++ code base that has a lot of legacy parts in it. Everything that I show, or hint at, in my article can be found in our code base in some shape or form, sometimes written by people who are not at the company anymore.
We have new C++ developers starting at our company who don't have a frame of reference because a lot of this stuff is not taught anymore. They need to be able to recognize the old patterns and improve upon them, without having the luxury to rewrite everything.
Thank you very much for the feedback! I think the least I can do is to rewrite the introduction so that the intention is clear from the beginning.