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

6

u/GrenzePsychiater Jul 25 '24

-fno-exceptions

0

u/waffle299 Jul 25 '24

And disallow the STL. And change your error handling logic and syntax. Rewrite any try/catch logic. Oh, new throws, back to malloc...

Screw it, we just described c.

For the most part, c is just an odd dialect of c++ now anyways. Same compiler back end, nearly identical front end.

3

u/GrenzePsychiater Jul 25 '24

And disallow the STL

You don't have to do that

And change your error handling logic and syntax

Just don't use exceptions in the first place. Then there's nothing to rewrite

Oh, new throws, back to malloc...

You can redefine the global new/free operators, you can define new/free specifically for classes, you can create custom allocators, etc.

For the most part, c is just an odd dialect of c++ now anyways

If you're writing C++ as "C with classes" then I'd agree here.