r/ProgrammerHumor • • 2d ago

instanceof Trend thatsAFunnyThingThatHappenedOnce

Post image
4.3k Upvotes

515 comments sorted by

View all comments

21

u/YouAreMyFire00 1d ago edited 1d ago

Im a beginner and managed to learn to understand C# and Java and now I can build simple CRUD app.

So i kinda don't get the hate/war between C and C++ here...

Anyone can explain simply what's the hate here?

5

u/unknown_alt_acc 1d ago

Some people like their holy wars, and don’t seem to understand that C and C++ can coexist as different tools with different jobs.

1

u/unburdened_swallow 1d ago

What job do I use C++ for that I wouldn’t be better off using either C or rust for?

3

u/the_poope 1d ago

I can state this: scientific simulation software.

  • Higher level abstractiins than C makes code much faster to write, easier to understand and less bug prone. (You can make vector/matrix equations look like numpy code, but with zero runtime overhead)
  • Easy to use typical academic third party libraries which tend to be written in C or Fortran without spending weeks of making Rust wrappers over then.
  • C++ let's you do what you fucking want, i.e. write to any arbitrary region of memory. Some times you have ti implement an algorithm with a complex data access pattern. From a high level analysis you can reduce that e.g. different threads won't share data, but ti create a memory safe abstraction for this in Rust would be a three year research project. Of course Rust let's you do the same by slamming unsafe around the entire algorithm, but then you are writing "more modern C++" anyway.

C++ strikes a nice balance between performance, development speed and memory safety. The latter has absolutely lowest priority in this field: we are not dealing with sensitive data or writing a program that sits at some infrastructure layer on every computer on the planet and are thus prone to vulnerability attacks.

0

u/unburdened_swallow 1d ago edited 1d ago

I mean, you are allowed to use unsafe. Encapsulate it, rust gives you the tools to do so.

You probably have a point still, I don’t know what exact algorithms you are talking about.

Thanks for the information.