5 ms·
If you're reaching for that hack, just use C++? You don't have to go all in on C++-isms, you can always write C-style C++ and only use the features you need.
by IAmLiterallyAB 1y ago
If you're reaching for that hack, just use C++? You don't have to go all in on C++-isms, you can always write C-style C++ and only use the features you need.
- waynecochran 1y agoNot always a viable option -- especially for embedded and systems programming.
- _proofs 1y agoi work in an embedded space in the context of devices and safety. if it were as simple as "just use c++ for these projects" most of us would use a subset, and our newer projects try to make this a requirement (we roll our own ETL for example). however for some niche os specific things, and existing legacy products where oversight is involved, simply rolling out a c++ porting of it on the next release is, well, not a reality, and often not worth the bureaucratic investment. while i have no commentary on the post because i'm not really a c programmer, i think a lot of comments forget some projects have requirements, and sometimes those requirements become obsolete, but you're struck with what you got until gen2, or lazyloading standardization across teams.
- Too 1y agoIn embedded you are typically stuck on some ancient proprietary compiler and can't take advantage of the latest C versions. Even less so if you need safety standards like MISRA. That of course doesn't help you with the switch away from C. The question is why they keep updating the language. The only ones with valid reasons to not upgrade to some more sane language can't take advantage of the new features.
- pton_xd 1y agoYeah as someone who writes C in C++, everytime I see posts bending over backwards trying to fit parameterized types into C I just cringe a little. I understand the appeal of sticking to pure C, but... why do that to yourself? Come on over, we've got lambdas, and operator overloading for those special circumstances... the water's fine!
- pjmlp 1y agoSome people will do as much as they can to hurt themselves, only to avoid using C++. Note as the newer versions are basically C++ without Classes kind of thing.
- glouwbug 1y agoI think the main appeal is subset lock-down and compile times. ~5000 lines in C gets me sub second iteration times, while ~5000 lines in C++ hits the 10 second mark. Including both iostream and format in C++ gets any project up into the ~1.5 second mark which kills my iteration interests. Second to that I'd say the appeal is just watching something you've known for a long time grow slowly and steadily.
- kilpikaarna 1y agoThis, and the two pages of incomprehensible compiler spam you get when you make a typo in C++.
- pjmlp 1y agoDepends pretty much on where you do such typo. If you mean templates, a kind of solved problem since C++17 with static_assert and enable_if, moreso in C++20 with concepts.
- pjmlp 1y agoUse binary libraries and modules, alongside incremental compilation and linking.
- sim7c00 1y agoyou are so right..thought hisotrically i would of disagreed just by being triggered. templates is the main thing c++ has over c. its trivial to circumvent or escape the thing u dont 'like' about c++ like new and delete (personal obstacle) and write good nice modern c++ with templates. C generic can help but ultimately, in my opinion, the need for templating is a good one to go from C to C++.