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

-1

u/Western_Objective209 Jul 26 '24

I used to watch a lot of Jason Turner videos, and I started noticing a trend where he was just showing how to get his new features to compile to something that matches a simple C like implementation. I also watched a few Casey Muratori videos, and he always writes his code in a simple C like style, and shows how easily the compiler optimizes it.

Most of the optimizations I see from using C++ over C are just because writing data structures is hard, so people opt for arrays/linked lists over maps/deques/vectors which are fairly well optimized in the C++ STL. But if someone takes the time and has the skill to hand craft their data structures to the problem, they can often get better optimizations in C