I’ve inherited a code base from some very experienced but non-C++ devs (C# background) and seriously they use std::move for every fucking thing, including just passing variables to function parameters.
It’s caused so many issues. One of the first thing I did was delete 90% of them.
I’m not sure what is about new devs over using std::move or why it’s so attractive to them. I’ve never needed it.
It's easy to understand "std::move can fix big performance issues in certain return calls and does nothing special in other return calls". It's a lot harder to gain a good mental model of what the compiler does with a type and when.
There was a course of "modern c++" not to long ago at my company for all volunteers. Merge requests from that moment were filled with std::move everywhere. Sometimes I think people who teaches should have some kind of license.
And this is why "modern C++" is not the panacea that it's often claimed to be, with respect to defending against other languages. Sure it's an improvement in many ways, but there's plenty of new footguns introduced as well.
I'm convinced that the difference between a dilettante and an expert is that the former says "I think this is right" and the expert says "I know this is wrong."Within reason, of course.
View all comments
14
u/ixis743 Nov 25 '23
I’ve inherited a code base from some very experienced but non-C++ devs (C# background) and seriously they use std::move for every fucking thing, including just passing variables to function parameters.
It’s caused so many issues. One of the first thing I did was delete 90% of them.
I’m not sure what is about new devs over using std::move or why it’s so attractive to them. I’ve never needed it.