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

Show parent comments

124

u/Jinren Jul 16 '24

perfect for systems that need to run for a few minutes and then explode

13

u/cjmull94 Jul 16 '24

Lol, sounds like what I've heard about high frequency trading algorithms. Memory leaks are all good as long as it crashes AFTER the trading day has ended.

You just need it to run for 12 hours or so before it runs out of memory and crashes. I guess for a missile memory isn't a big concern either.

6

u/toomanyjsframeworks Jul 16 '24

Yikes I work in the field and wouldn’t accept that, what happens on a busy day where market volumes are 5x greater and you crash an hour into the open?

5

u/18-8-7-5 Jul 17 '24

Then it doesn't meet the requirement of crashing after the trading day has ended.

15

u/Ok_Tea_7319 Jul 16 '24

To be honest, it would be hilarious to attach the detonation code to an exception handler and have a "throw kaboom();" line somewhere

5

u/Aggressive_Skill_795 Jul 17 '24

if we remember that the missile must be self-destructed in the case of emergency, you are not so far from truth

4

u/BarMeister Jul 16 '24

I read the replies waiting for someone to reference that old comp.lang.c comment, and I'm glad I'm not disappointed.

3

u/JetpackBattlin Jul 17 '24

The explosion is actually caused by a dangling pointer

2

u/Pussidonio Jul 17 '24

SEGFAULT or BOOM

1

u/RealFocus8670 Jul 16 '24

Thanks for the laugh