r/cpp • • Jul 13 '22

Why does Linus hate C++ ?

308 Upvotes

436 comments sorted by

View all comments

Show parent comments

22

u/TheFlamingDiceAgain Jul 14 '22

> cant be trusted to write highly optimized code.

The entire high performance computing community would like to disagree with this

0

u/another_day_passes Jul 14 '22

HPC is mostly Fortran and C no?

7

u/TheFlamingDiceAgain Jul 14 '22

C++, C, and Fortran. C++ can always be written like C and for HPC applications is often faster that C or Fortran because of the extra info you can give the compiler (templates etc); plus there’s just more time spent on C++ compilers since it’s more popular in general. The US Department of Energy is also really pushing C++ for their supercomputers and is heavily involved in developing C++ with better accelerator support. If you’re writing a new HPC code now you should probably write it in C++

1

u/another_day_passes Jul 14 '22

I said so because all the HPC codebases I’ve worked in are written in pure C. Also all the cornerstone libraries in HPC such as SuiteSparse or PETsC or even MKL are written in C.

→ More replies (3)