3 ms·
I used to feel the same. For a long time I got away with using C and python for everything. They paired well and I always came away feeling that my code was e
by gattis 5y ago
I used to feel the same. For a long time I got away with using C and python for everything. They paired well and I always came away feeling that my code was expressed elegantly enough for me. C was for stuff that had to be fast, python for things that were more functional or meta.
Then I started a project that needed to be faster than python but also required some heavy-ish meta-programming. I wrangled for way too long with the C preprocessor, and while way more powerful than I had imagined, still fell well short of being able to do what I needed without it looking and feeling like a dog that had to be put down. I think I would have needed a code-generating script to do it and to me that sounds disgusting. But C++ templates did exactly what I needed. They look awful and I still don't even understand my own code when I try to go back and read it. But it made me understand and appreciate that C++ does have a place, and for certain projects it might actually be the best choice. I'm sure some fan boys of the newer C++ descendents (rust/golang/zig/et al) will disagree.
- Glavnokoman 5y agoType parametrization is actually done better in Zig. I wish it departed from "no implicit actions" dogma and let RAII in. It would be almost perfect...
- erdeszt 5y agoI kinda like that `defer` is very visible. Although I haven't worked on large Zig codebases so I don't know how that scales.
- Glavnokoman 5y ago`defer` does not allow passing ownership so it limits your designs quite significantly.
- LeCow 5y agoI prefer Rust simply because it's safer and C++ has become monolithic. Also gotta love an excellent package manager.
- vips7L 5y agoThe problem with Rust is that it still can't hit all of the targets that C++ can. I have to support IBM AIX and HP-UX and the only things that I know of that run there are C/C++ and Java.
- rramadass 5y agoThis is the usp of C++, it is a set of languages which can be combined as needed depending upon problem requirements (aka Multi-Paradigm). I personally always start with a subset and only add features as needed. Two old books which i found useful in thinking about how to use C++ are; Scientific and Engineering C++ by Barton and Nackman. Multi-paradigm design for C++ by James Coplien. I have not as yet found any equivalents for "Modern C++".