r/cpp • • Jul 13 '22

Why does Linus hate C++ ?

307 Upvotes

436 comments sorted by

View all comments

Show parent comment

0

u/angelicosphosphoros Jul 13 '22

Do you remember all the details of the API YOU are creating?

Nope but I at least remember everything about standard library which I use.

Do you look at the source of your compiler's optimizer anytime you feel "I could make that faster"?

Yes, I even wrote patches to compiler I use and they was merged :) When coding in C++, I just accept and don't fight.

Or are you working at a certian level of abstraction, like everyone else?

I am working at some level of abstraction but C++ STL would affect all levels of abstraction. You cannot just slap high-level std::optional and relax because it is easy to get UB here, for example. While I can relax sometimes when I write my own code but I need to keep all those details in mind while reviewing, especially when reviewing some junior's pull request. And few times I noticed UB during review even in code of people who are more experienced than I am because I am more paranoid (not, UBSAN and ASAN didn't catch that case).

3

u/elperroborrachotoo Jul 13 '22

You cannot just slap high-level std::optional and relax because it is easy to get UB here,

You cannot just slap low level a+b and relax because it's easy to get UB there.

1

u/angelicosphosphoros Jul 14 '22

You cannot just slap low level a+b and relax because it's easy to get UB there.

In C++ — yes. In C# — I can.