Overview
Explore common C++ coding pitfalls and best practices in this 38-minute video tutorial. Learn about efficient memory allocation, API design, code organization, variable initialization, class hierarchies, state management, preprocessor directives, and more. Discover tips for writing cleaner, more efficient C++ code, including proper use of structs vs. classes, handling compilation warnings, and leveraging std::weak_ptr. Gain insights to improve your C++ programming skills and avoid common mistakes that can lead to code failures.
Syllabus
- Hello
- ALWAYS stack allocate if you can
- The cat is back
- API design considerations
- return 0 in the main function
- Organization and code conventions
- Variable intialization
- Deep class hierarchies
- Managing states
- defines
- Avoid copying causing unnessary heap allocations
- More on #define
- Consistent code style
- Compilation warnings
- Logging and release builds
- struct vs class
- Cleaner code
- Final thoughts and conclusion
- Use std::weak_ptr
Taught by
The Cherno