r/ProgrammerHumor • • Oct 17 '26

instanceof Trend thatsAFunnyThingThatHappenedOnce

Post image
4.6k Upvotes

524 comments sorted by

View all comments

Show parent comment

3

u/the_poope Oct 18 '26

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 Oct 18 '26 edited Oct 18 '26

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.