r/cpp_questions • • Sep 13 '24

OPEN Why Linux community hates C++ so much?

It seems like they have an extreme disliking towards C++. Especially the kernel developers. Linus has even said he doesn't allow C++ in kernel just to keep C++ programmers away. Which sounds very weird because C++ seem to be used in all kinds of complicated systems, and they are fine.

175 Upvotes

192 comments sorted by

View all comments

Show parent comments

4

u/HumaNOOO Sep 14 '24

skill issue

0

u/maverick_labs_ca Sep 14 '24

No, not a skill issue. Know your hardware.

2

u/UnicycleBloke Sep 14 '24

Know your tools. In my experience, C devs who complain about C++ have typically written little, if any, C++.

I find it tragicomic that the embedded domain and the Linux kernel are particularly strong in C worship. These are two areas which could have benefitted immeasurably for decades from using a far more expressive language with vastly superior compile time checking. Of course some of the C++ haters now evangelise Rust. It is a fine language but that is a rather irritating volte face.

0

u/maverick_labs_ca Sep 14 '24

I have written over 200k lines of c++ code. In fact I have been writing code longer than you have been alive.

There is zero benefit to using C++ in small embedded applications.

Have a good life

1

u/UnicycleBloke Sep 14 '24 edited Sep 14 '24

Well it wasn't directed at you personally but a comment on my experience. I've been writing software since the early 80s, C++ since the early 90s.

On C++ in embedded applications you are simply wrong. I have used it productively for almost 20 years, largely avoiding many of the run time errors which have routinely plagued my coworkers and others during that time. In fact many colleagues switched to C++. I have also written C when necessary (smaller platforms without a C++ compiler, or client insistence), and studied a great deal of C in vendor code and elsewhere. There was little that could not have benefitted from some better abstractions. It would likely have been simpler, smaller, safer and/or at least as efficient in C++.

I've always thought it a great pity that C and C++ devs became so polarised, rather than C++ being seen as the evolution of C. Even the smallest systems might benefit from at least some C++ features, such as constexpr or better type safety.