2 ms·
For me the legitimate reason to code C is to get stuff done, period. There is hardly a need for more (to do what I do -- systems in the broadest sense) and the
by jstimpfle 4y ago
For me the legitimate reason to code C is to get stuff done, period.
There is hardly a need for more (to do what I do -- systems in the broadest sense) and there's a lot of time saved by not thinking about 21 "safe" and "ergonomic" ways to write everything in C++ (that very often end up being not that safe, and unintelligible).
Yes, there is the "subset" argument, only use what you need. But I don't buy that, I'm not like that, it doesn't work for me. Constraining myself makes things easier.
- glowingly 4y agoThis somewhat mirrors my own development. I started in C, and am still in it for systems/OS development at work. In UI development, we had older C toolkits, but are replacing them with newer toolkits that are C++. I started off trying to just do C business logic with some C++ glue code for the UI. Sticking to what's familiar. In the end, it was just easier to do everything properly. All C in areas that are C. All C++ in areas that are C++. Same with C#. Trying to mix them is just more work than necessary. At least I get to add C++ to my resume. There is a little joke at work, w.r.t. our existing codebases and code choices. They are career-driven choices, not technical choices. The result is a mess of a codebase, but I'm fully embracing that now.
- RcouF1uZ4gsC 4y ago> For me the legitimate reason to code C is to get stuff done, period. If I want to just get stuff done, C++ is great for that. Don’t underestimate how much you gain by having string, vector, and map when you just want to crank out code. Nobody is forcing you to overdesign stuff. You can always just crank out the code you want.
- dkersten 4y agoYeah, just having the standard library container types (or similar generic third party libraries if you don’t like std ones, eg I tend to use phmap maps and sets instead of std::unordered_map/set). Templated containers just make using them so much easier than generic containers in C. Ergonomics matter when you just want to get things done. Plus the C++ containers make it easier to manage memory IMHO. The main reason I still sometimes use C is compiler support for microcontrollers where everything tends to have a C compiler but not everything has a C++ one (or if it does, not necessarily an up to date one). I don’t use either in my day to day really but I do have sone personal projects. Ultimately I foresee doing these in Rust where I can, but for stuff like hobbyist game development, I’m currently too bought into some of the C++ libraries, primarily EnTT, but even there I think I’ll eventually just end up using Rust with Bevy. For now though, I actually quite enjoy using C++17 (and maybe 20 soon if I find the free time).
- pjmlp 4y agoEven something like Turbo C++ for MS-DOS is preferable to raw C, the only embedded toolchains that don't offer even that are usually stuff like PIC and similar. Which, in any case, have companies like Mikroe selling Basic and Pascal compilers.