C++ Best Practices for Developers

C++ Best Practices for Developers

50mBeginner2018-12-06

Authors

Troy Miles

Troy Miles

Award-winning Software Engineer, Speaker, and Author

Course details

There have been several updates to C++ over the years. In this course, learn best practices that can help you produce higher-quality C++ code by leveraging tools and new features. To begin, instructor Troy Miles provides a high-level overview of the major features introduced in the 2011, 2014, and 2017 updates to the C++ language. Next, he goes over a few tools that can help you improve your code, including how to boost your code's quality and reliability using static analyzers. Troy also shares practical tips for using the new C++ features correctly, as well as rules and techniques for managing objects.

Learning objectives
Major new C++ features
Turning on modern C++
Letting the compiler help
Using the new features correctly
Using auto type deduction
Using lambdas
Range-based for loops
How C++ and the Standard Template Library name things
Making the best of the filesystem library
Managing objects

Skills covered

C++PersonaProgramming LanguagesOpen SourceSoftware Development

Concepts

0. Introduction

  • 01 - Write better C++ code
  • 02 - What you should know

1. What Is Modern C++

  • 03 - New C++ features
  • 04 - Old code compatibility
  • 05 - File naming conventions

2. Tools That Improve Your Code

  • 06 - Turning on modern C++
  • 07 - Let the compiler help
  • 08 - Static analyzers
  • 09 - Cppcheck
  • 10 - Challenge - Finding issues with Cppcheck
  • 11 - Solution - Finding issues with Cppcheck

3. Using the New Features Correctly

  • 12 - Auto type deduction and initialization
  • 13 - Range-based for loops
  • 14 - Strongly typed enums
  • 15 - Using lambdas
  • 16 - The magic of variadic template functions
  • 17 - Challenge - Writing an integer sum method
  • 18 - Solution - Writing an integer sum method

4. Don't Reinvent the Wheel

  • 19 - How C++ and the STL name things
  • 20 - Map, filter, and reduce
  • 21 - Be careful with string view
  • 22 - size t and auto
  • 23 - The filesystem library
  • 24 - Challenge - Writing strings to a file
  • 25 - Solution - Writing strings to a file

5. Managing Objects

  • 26 - Which pointer when
  • 27 - The rules of zero and three
  • 28 - const is your friend
  • 29 - Resource Acquisition Is Initialization (RAII)
  • 30 - Challenge - RAII
  • 31 - Solution - RAII

Conclusion

  • 32 - Next steps
40,000 Toman