Re:It's not what programming languages do, it's what they sh...
by cryptonector on Friday March 27, 2020 @01:37AM
(#22700651)
I write or deal with a lot of C, unfortunately. I try very hard to not have global variables, and to minimize sharing between threads. When I pick up a C codebase, one of the first things I do is build it and inspect the object files to see what globals exist. The same can be done in C++, and should be. Use inheritance sparingly. Don't use exceptions if at all possible. Use modern C++ as much as possible, and borrow ideas from Haskell/Rust as much as possible. I'm thinking of https://stackoverflow.com/questions/9692630/implementing-has...
[ Parent
| on HN ]
Re:It's not what programming languages do, it's what they sh...
by pjmlp on Friday March 27, 2020 @02:38AM
(#22700816)
I am so glad when I got to use C, I already had a good school of modular programming languages behind me.
On my own projects, like university assignments, I would treat each translation unit as a kind of module, anything that for whatever reason could not be in a handle structure would be a internal static (years later I started using TLS instead), and in some cases incomplete structs as means to avoid the temptation to directly access internal data.