C++ Code Smells
summary
Counts about 748 best-practice rules but narrows to concrete smells and fixes: construction vs assignment leads to needless temporaries but modern GCC9 often elides them; out parameters and raw loops become clearer with value returns and algorithms; watch redundant std::move that breaks RVO; avoid implicit conversions and const_cast that cause UB; replace static local strings with constexpr string_view to skip guard checks; run clang-tidy and enable precision warnings. The conclusion lists three actionable smells and specific tool checks that catch them.
AI-written summary · about
chapters (20)
- 0:00Jason Turner
- 1:25C++ Best Practices
- 4:28Construction Separate From Assignment - Ben Deane
- 10:50Raw Loops
- 13:12Multi-Step Functions Multi-step functions are hard to reason about, debug, and maintain
- 19:03Non-Cannonical Operators
- 21:41Code With Conversions
- 25:29Casting Away const
- 28:56static const
- 34:16extern const
- 36:51Raw new and delete
- 37:13Code Smells
- 41:39Let's Update This Code Sample #2
- 46:56Do You const Value Parameters?
- 47:55Do you const Temporary Values?
- 52:18Do You const Value Return Types?
- 53:33Missing and Ignored Compiler Warnings Special checks for many of these things
- 53:59Missing const and constexpr, Misplaced const . Why isn't that value or member function
- 54:40Weak Types And Casts Unfortunately the C++ standard Ubrary does not help us here
- 55:31Bonus Code Review
related talks
51mSimplicity: Not Just for Beginners
01h 11mPragmatic Simplicity - Actionable Guidelines To Tame Cpp Complexity
57mRefactoring and Code Smells.
06mLightning Talk: Best Practices Every C++ Programmer Needs to Follow
52m“Tools from the C++ eco-system to save a leg”
58m10 Techniques to Understand Existing Code
46mCode Smells - Hall of Fame
50mPruning Error Messages From C++ Template Code
