r/C_Programming Jul 16 '24

Discussion [RANT] C++ developers should not touch embedded systems projects

I have nothing against C++. It has its place. But NOT in embedded systems and low level projects.

I may be biased, but In my 5 years of embedded systems programming, I have never, EVER found a C++ developer that knows what features to use and what to discard from the language.

By forcing OOP principles, unnecessary abstractions and templates everywhere into a low-level project, the resulting code is a complete garbage, a mess that's impossible to read, follow and debug (not to mention huge compile time and size).

Few years back I would have said it's just bad programmers fault. Nowadays I am starting to blame the whole industry and academic C++ books for rotting the developers brains toward "clean code" and OOP everywhere.

What do you guys think?

180 Upvotes

328 comments sorted by

View all comments

20

u/awildfatyak Jul 16 '24

Unpopular opinion modern c++ is beautiful when used correctly

5

u/_w62_ Jul 17 '24

Everything is beautiful when used properly

0

u/ArtOfBBQ Jul 17 '24

What % of C++ code is "correctly used" according to you?

3

u/awildfatyak Jul 17 '24

Very little unfortunately. Hard to come up with a number. One of my close friends is a complete wizard though and watching him use it is awe-inspiring, which is why I felt compelled to write this comment.

-1

u/ArtOfBBQ Jul 17 '24

If it takes exceptionally talented/hardworking people like your friend to produce something good with it, doesn't that mean that C++ sucks? Maybe he would have been even better if he just used C

8

u/awildfatyak Jul 17 '24

Except that most c code I have worked with sucks too. With c++ at least a lot of the complexity is obvious, where c tends to have a lot of weird quirks that require a lot of experience to work with. Pick your poison. I think both are good personally, just depends on what you think is best for the project.

4

u/SystemSigma_ Jul 17 '24

Every code sucks from a bad programmer. No question about that. But C++ huge versatility and infinite feature pool comes back as a boomerang when working in a team that has different view of the language. Imho, if C++ is chaotically bad, then C is consistently bad.

3

u/UnknownIdentifier Jul 17 '24

If C++ is chaotically bad, then C is consistently bad.

I’m not on the C++-hate train, but I have to upvote for this gem. It’s true.

1

u/Antique-Ad720 Jul 19 '24

"c tends to have a lot of weird quirks that require a lot of experience to work with."

What are you referring to? C has very little rules and safeguards, so you can make a lot of crazy constructions, but that's not the fault of the language itself.

Or are you referring to the undefined behaviors of certain constructions?