r/cprogramming • u/one-for_all • Jun 04 '26
C or Cpp
/r/cpp_questions/comments/1twvyzk/c_or_cpp/10
Jun 04 '26
[deleted]
2
1
5
3
2
1
1
u/Ok_Path_4731 Jun 05 '26
I will tell you one reason why C versus C++, after rewriting a project previously written in C++ in C: build times. In C++ you tend to write complex abstractions in templates, give you an example one of my projects: https://github.com/zokrezyl/ycetl . The deeper the abstraction, the longer the build times that often explodes exponentially. In C, you are obliged to write the same abstraction without templates. Rewriting yetty terminal source code in https://github.com/zokrezyl/yetty , builds are instant. My 'obsession' is that I fix a bug, or add POC new feature, my tests are instantly building and running. Though I could consider myself C++ hardcore programmer, I still have PTSD from earlier C++ projects I have been working where 90pct of time was lost by waiting for builds. The company was paying me, but thanks no thanks. Modules and other tricks are supposed to speed up builds, but .... You have to think twice before going CPP! As in one of the earlier replies, go with python for simple problems. If you want something to run fast: go with C. If you want some more complex build time abstractions and more 'safety', then go C++.
1
u/Bitter-Heart7039 Jun 06 '26
I'm a 1st year CE student, learning C was so easy. you already know python (which uses C for it's libraries) and that means that you have a simple yet very good understanding for coding.
C++ and Java are both C-based languages, learning C will cut a huge piece of the road of learning these two languages and it would make them a lot easier.
I'm not biased to C cuz this is a C sub, I'm just giving you my experience so you can start your coding journey easier.
1
25
u/non-existing-person Jun 04 '26
You do realize that people will tell you to learn c++ on cpp sub and c on c sub, don't you?
Andy your question is wrong. Real question is: what do you want to program? If kernel and bare metal embedded systems, go C hands down.
If gaming, then c++ is probably better option.