Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Why C++ Code Failed - Common Mistakes and Best Practices

The Cherno via YouTube

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

Reviews

Start your review of Why C++ Code Failed - Common Mistakes and Best Practices

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.