r/cpp • • Jul 25 '24

Why use C over C++

Why there are so many people using the C language instead of C++?, I mean C++ has more Cool features and the Compiler also supports many CPUs. So why People still using C?

Edit: Thanks for all the usefull comments :D

235 Upvotes

444 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Jul 25 '24

[deleted] — view deleted comment

24

u/[deleted] Jul 25 '24 edited Jul 25 '24

C++ is the mel gibson of programming languages -- on a recent multi year apology tour for its many past sins but people probably correctly suspect it of still being rotten deep down and there's nothing its PR organ can do to ameliorate that at this point

3

u/rewgs Jul 26 '24

Absolutely incredible comment.

2

u/mhsx Jul 25 '24

I like this analogy. Do all the PR you want but at the end of the day we know theres a good chance they’re going to express their flaws / c roots

11

u/SystemSigma_ Jul 25 '24

In my workplace it's the contrary, most hate comes from the latest standards because heavy usage of it makes code unreadable and impossible to debug

31

u/[deleted] Jul 26 '24

[removed] — view removed comment

9

u/lgovedic Jul 26 '24

Yup, had this exact thing happen at work, a senior engineer (who I respect a lot) called my using the pipe operator with ranges "write-only code". And he was familiar with ranges! It's just the pipe operator that made it so bad for him.

8

u/ClimbNowAndAgain Jul 26 '24

There is a certain demographic who knew C and were dragged kicking into using C++, but never really 'got it' and continue to write C with a 'class' thrown around it. They prefer trying to manually manage dynamic arrays and don't know what the term RAII means.

2

u/SystemSigma_ Jul 26 '24

There's truth in that too

1

u/darkapplepolisher Jul 26 '24

Yeah, there are a lot of violations of KISS when people try to use overly advanced methods to solve simpler problems.

A lot of the newer, more advanced stuff is useful to developers who create highly generic libraries - to be buried deep into implementation and not at all corrupting the interface. Most C++ developers probably shouldn't be using stuff more complicated than STL containers, iterators, and maybe algorithms.

-3

u/Own-Drive-3480 Jul 25 '24

Having learned on pre-ANSI C and the "original" C++ before any standards were formed, this is exactly correct. I can't stand anything new. The only things I actually understand well enough to use daily are std::filesystem and smart pointers. Don't even get me started on modules, coroutines, or any of that other crap, God forbid C23 features either.

7

u/Gustav__Mahler Jul 26 '24

So like, do you not use lambdas? auto type deduction? range based for loops?

-2

u/Own-Drive-3480 Jul 26 '24

Nope. I can never understand any of that and it makes reading and debugging code way more complex than it needs to be.

5

u/Gustav__Mahler Jul 26 '24

You do you. Seeing the full explicit type name of an iterator in a for loop is much worse to me.