3 ms·
> You can get quite far treating C++ as C with classes I'm teaching a HPC (threading/openmp/mpi) class and that's exactly what we do. We switched from regular
by ascar 3y ago
> You can get quite far treating C++ as C with classes
I'm teaching a HPC (threading/openmp/mpi) class and that's exactly what we do. We switched from regular C to C++ for classes and some standard library data structures and that's that. It makes our lifes easier and stuff is still "easy" enough to understand and work with.
I've once had to work with a cryptography codebase using excessive templating. It was an absolute nightmare to deal with and the only person I know of able to understand the codebase was the original author.
- sumtechguy 3y agoUsing templates that way is totally possible. The problem is the nesting you end up with makes it hard to follow what is going on as you discovered. I like to use templates to replace #define style programming. As it makes it easier to debug what is going on and get the compiler to work for you instead of in the background and hoping it spits out the right thing to feed to the next stage in the compiler pipeline. Many languages have these sort of 'yeah you can do that but you probably shouldnt' things. C++'s version of that is templates (for a long time it was giant trees of classes). You get sucked into how cool it is then realize you have made a horrible mistake and made a giant mess that you can barely comprehend much less debug.