Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library

Comment by krona

2 months ago

clang-tidy has a check for this. https://clang.llvm.org/extra/clang-tidy/checks/bugprone/use-...

MSVC and the Clang static analyzer have a analysis checks for this too. Not sure about GCC.

It's worth remembering though that values can be reinitialized in C++, after move.

1 comment

krona

Reply

DLoupe  2 months ago

I think you missed my point. The problem is not lack of guarding against programmer mistakes. It's that the compiler generates unnecessary code.

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities