Last active
May 16, 2026 11:21
-
Star
(1,249)
You must be signed in to star a gist -
Fork
(72)
You must be signed in to fork a gist
-
-
Save bkaradzic/2e39896bc7d8c34e042b to your computer and use it in GitHub Desktop.
Orthodox C++
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No, guys.
Even Orthodox C++ doesn't fix the fundamental problem with C++, where any class can behave however it wants depending on its set of constructors and destructor. A class can be a value type (copied by value), act like a reference type, have an explicit free() method, or be a proxy value type that references a ref-counted object which destroys itself when the last reference in scope disappears. And that's not even mentioning the ability to template all of this and essentially create a mini programming language on top of C++.
Because of this variety, you are forced to study every single class to keep in your head exactly how it behaves during assignment and argument passing.
This results in multiple layers of mental pattern unfolding while reading code. Very high cognitive load.
Even if you add a rule to Orthodox C++ banning the use of class and constructors inside struct, it still doesn't save you from classes with diverse constructors coming from other libraries you use - because a library might provide an API where the class is designed as a proxy to a ref-counted object.
This would mean that such "Orthodox C++" needs its own separate repository of libraries, which is obviously absurd.
In light of this, using C++ even as "C+" just for namespaces and function overloading isn't worth the effort. Plain C is cognitively simpler: you know that all structs are copied by value, and the compiler simply won't accept anything else.