2022-04-14 06:43:12 +02:00
# Modern C++ Programming
2022-10-23 04:15:16 +02:00
< p align = "center" >
2021-11-28 16:06:01 +01:00
< img src = "other/cpp_logo.png" / >
2022-10-23 04:15:16 +02:00
< / p >
< p align = "center" >
< a href = "https://github.com/federico-busato/Modern-CPP-Programming/releases" alt = "Release" >
< img src = "https://img.shields.io/github/v/release/federico-busato/Modern-CPP-Programming?style=for-the-badge" / >
< / a >
< / p >
2023-12-03 01:54:13 +01:00
< p align = "center" >
< a alt = "Stars" >
< img src = "https://img.shields.io/github/stars/federico-busato/Modern-CPP-Programming?style=for-the-badge" / >
< / a >
< a href = "https://github.com/federico-busato/Modern-CPP-Programming/network/members" alt = "Forks" >
< img src = "https://img.shields.io/github/forks/federico-busato/Modern-CPP-Programming?style=for-the-badge" / >
< / a >
< / p >
2022-10-23 04:15:16 +02:00
< p align = "center" >
< a href = "https://github.com/federico-busato/Modern-CPP-Programming/commits/master" alt = "Commits" >
< img src = "https://badgen.net/github/commits/federico-busato/Modern-CPP-Programming?style=for-the-badge&scale=1.2" / >
< / a >
< / p >
< p align = "center" >
2023-12-03 01:54:13 +01:00
< a href = "https://github.com/federico-busato/Modern-CPP-Programming-Material/issues" alt = "Issues" >
< img src = "https://badgen.net/github/closed-issues/federico-busato/Modern-CPP-Programming?style=for-the-badge&scale=1.2" / >
2022-10-23 04:15:16 +02:00
< / a >
< / p >
2023-03-19 00:00:53 +01:00
## C++11 / C++14 / C++17 / C++20 / (C++23)
2018-03-08 12:04:09 +01:00
2021-11-01 13:59:47 +01:00
This *open-access* course is directed at those who are already familiar with C and object-oriented programming towards a proficiency level of C++ programming. The course covers the basics of C++ programming and moves on to advanced C++ semantics and concepts.
**Key features**:
- *Free and frequently updated*
2023-12-03 01:54:13 +01:00
- *22 lectures, ~1500 slides*
2021-11-01 13:59:47 +01:00
- Include the *last language standard* concepts and features
2023-12-03 01:54:13 +01:00
- *Practical teaching*: non-verbose, short structured descriptions associated with code
2021-11-01 13:59:47 +01:00
- *Minimal code examples* for showing just a specific feature or issue without digressing
- *Complementary language aspects*: tools, coding conventions, project organization, and code optimization
- *Experience-based*: many aspects, examples, and problems come from real-world cases faced during my work as software engineer
If you enjoy the course or you find it useful, please add a **Star**
2021-11-28 15:58:39 +01:00
2021-11-01 13:59:47 +01:00
[](https://github.com/federico-busato/Modern-CPP-Programming)
2022-04-14 06:43:12 +02:00
## CHAPTERS
2024-02-05 06:56:30 +01:00
| # | TITLE | MAIN FOCUS |
| ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| **1** | [**Introduction** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/01.Introduction.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/01.Introduction.html)) | History of C/C++, Areas of Applications, Course introduction |
| **2** | [**Basic Concepts I - Fundamental Types** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/02.Basic_Concepts_I.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/02.Basic_Concepts_I.html)) | Types overview, operators, and conversion |
| **3** | [**Basic Concepts II - Integral and Floating-point Types** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/03.Basic_Concepts_II.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/03.Basic_Concepts_II.html)) | Integral and floating-point types and their arithmetic |
| **4** | [**Basic Concepts III - Entities and Control Flow** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/04.Basic_Concepts_III.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/04.Basic_Concepts_III.html)) | Enumerators, structures, control flow statements |
| **5** | [**Basic Concepts IV - Memory Management** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/05.Basic_Concepts_IV.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/05.Basic_Concepts_IV.html)) | Heap, Stack, pointers, references, const properties, conversion operators |
| **6** | [**Basic Concepts V - Functions and Preprocessing** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/06.Basic_Concepts_V.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/06.Basic_Concepts_V.html)) | Functions, lambda expressions, preprocessing directives |
| **7** | [**Object Oriented Programming I - Class Concepts** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/07.Object_Oriented_I.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/07.Object_Oriented_I.html)) | Class hierarchy, constructor, destructor, class keywords |
| **8** | [**Object Oriented Programming II - Polymorphism and Operator Overloading** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/08.Object_Oriented_II.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/08.Object_Oriented_II.html)) | Polymorphism, operators overloading |
| **9** | [**Templates and Meta-programming I - Function Templates and Compile-Time Utilities** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/09.Templates_I.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/09.Templates_I.html)) | Function template, type traits |
| **10** | [**Templates and Meta-programming II - Class Templates and SFINAE** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/10.Templates_II.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/10.Templates_II.html)) | Class template, SFINAE |
| **11** | [**Translation Units I** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/11.Translation_Units_I.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/1.Translation_Units_I.html)) | Linkage and One Definition Rule |
| **12** | [**Translation Units II** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/12.Translation_Units_II.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/12.Translation_Units_II.html)) | Dealing with multiple translation units and files, `#include` , and modules |
| **13** | [**Code Conventions** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/13.Code_Convention.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/13.Code_Convention.html)) | Project organization and main code conventions |
| **14** | [**Ecosystem I** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/14.Ecosystem_I.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/14.Ecosystem_I.html)) | Debugging, and testing |
| **15** | [**Ecosystem II** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/15.Ecosystem_II.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/15.Ecosystem_II.html)) | Cmake, documenting, and other Tools |
| **16** | [**Utilities** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/16.Utilities.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/16.Utilities.html)) | Main `std` libraries |
| **17** | [**Containers, Iterators, and Algorithms** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/17.Iterators_Containers_Alg.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/17.Iterators_Containers_Alg.html)) | Containers, iterators, algorithms, ranges |
| **18** | [**Advanced Topics I** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/18.Advanced_Topics_I.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/18.Advanced_Topics_I.html)) | Move semantics, universal reference, type deduction |
| **19** | [**Advanced Topics II** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/19.Advanced_Topics_II.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/19.Advanced_Topics_II.html)) | Error handling, C++ idioms, smart pointers |
| **20** | [**Optimization I - Basic Concepts** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/20.Optimization_I.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/20.Optimization_I.html)) | Ahmdal Law, performance bounds, architecture concepts (ILP, SIMD, etc.), memory hierarchy |
| **21** | [**Optimization II - Code Optimization** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/21.Optimization_II.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/21.Optimization_II.html)) | Arithmetic optimizations, memory optimizations, etc. |
| **22** | [**Optimization III - Non-Coding Optimizations and Benchmarking** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/22.Optimization_III.pdf ) ([html](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/22.Optimization_III.html)) | Compiler optimizations, profiling and benchmarking tools |
***ALL-IN-ONE BOOK***: [**modern-cpp.pdf** ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/modern-cpp.pdf ) (could be a few commits behind), [html ](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/htmls/modern-cpp.html )
2023-12-03 01:54:13 +01:00
2023-04-03 03:58:07 +02:00
## TOPICS IN DETAILS
2018-03-08 12:04:09 +01:00
2020-03-01 13:09:56 +01:00
**[1. Introduction](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/01.Introduction.pdf)**
2018-03-08 12:04:09 +01:00
2021-03-04 22:54:21 +01:00
* **A Little History of C/C++ Programming Languages**
* **Areas of Application and Popularity**
* **C++ Philosophy**
2023-03-19 00:00:53 +01:00
* **C++ Weakness**
2021-03-04 22:54:21 +01:00
* **Books and References**
* **The Course**
2023-12-21 22:34:43 +01:00
**[2. Basic Concepts I - Fundamental Types and Operations](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/02.Basic_Concepts_I.pdf)**
2021-03-04 22:54:21 +01:00
* **Preparation**: What compiler should I use?, What editor/IDE compiler should I use?, How to compile?
* **Hello World**: I/O Stream
2021-09-19 18:39:53 +02:00
* **C++ Fundamental Types Overview**: Arithmetic types, Non-standard arithmetic types, `void` type, Pointer type and `nullptr`
2021-03-04 22:54:21 +01:00
* **Conversion Rules**
2022-04-14 06:43:12 +02:00
* **`auto` declaration**
2023-09-15 01:30:21 +02:00
* **C++ Operators**: Operators precedence, Prefix/Postfix increment/decrement, Assignment, Compound , and Comma operators, Spaceship operator `<=>` , Safe Comparison Operators
2023-11-20 21:43:18 +01:00
**[3. Basic Concepts II - Integral and Floating-point Types](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/03.Basic_Concepts_II.pdf)**
2023-12-21 22:34:43 +01:00
* **Integral Data Types**: Fixed width integers, `size_t` and`ptrdiff_t`, Signed/Unsigned integer characteristics, Promotion, Truncation, Undefined behavior
2023-10-23 23:41:29 +02:00
* **Floating-point Types and Arithmetic**: IEEE Floating-point Standard and Other Representations, Normal/Denormal values, Infinity, Not a Number (`NaN`), Machine Epsilon, Units at the Last Place (ULP), Cheatsheet, Summary, Arithmetic Properties, Detect Floating-point Errors
2022-04-14 06:43:12 +02:00
* **Floating-point Issues**: Catastrophic cancellation, Floating-point comparison
2021-03-04 22:54:21 +01:00
2023-11-20 21:43:18 +01:00
**[4. Basic Concepts III - Entities and Control Flow](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/04.Basic_Concepts_III.pdf)**
2021-03-04 22:54:21 +01:00
2023-12-21 22:34:43 +01:00
* **Entities**
* **Declaration and Definition**
2021-03-04 22:54:21 +01:00
* **Enumerators**
2023-03-19 00:00:53 +01:00
* **`struct`, Bitfield, `union` **
2023-12-21 22:34:43 +01:00
* **Control Flow**: `if` Statement, `for` Loop, Range-base `for` loop, `switch` , `goto` , Avoid unused variable warning `[[maybe unused]]`
2021-03-04 22:54:21 +01:00
2023-12-21 22:34:43 +01:00
**[5. Basic Concepts IV - Memory Concepts](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/05.Basic_Concepts_IV.pdf)**
2021-03-04 22:54:21 +01:00
2023-03-19 00:00:53 +01:00
* **Heap and Stack**: Stack Memory, `new` , `delete` , Non-allocating placement allocation, Non-throwing allocation, Memory leak
2023-09-15 01:30:21 +02:00
* **Initialization**: Variable initialization, Uniform initialization, Fixed-size array initialization, Structure initialization, Dynamic memory initialization
2022-04-14 06:43:12 +02:00
* **Pointers and References**: Pointer Operations, Address-of operator `&` , Reference
2023-09-15 01:30:21 +02:00
* **Constant and Literals, `const` , `constexpr` , `consteval` , `constinit` **, `if constexpr` , `std::is constant evaluated()` , `if consteval`
2023-10-23 23:41:29 +02:00
* **`volatile` keyword**
2021-09-19 18:39:53 +02:00
* **Explicit Type Conversion**: `static_cast` , `const_cast` , `reinterpret_cast` , Type punning
2020-03-01 12:50:30 +01:00
* `sizeof` Operator
2019-03-04 11:29:53 +01:00
2023-11-20 21:43:18 +01:00
**[6. Basic Concepts V - Functions and Preprocessing](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/06.Basic_Concepts_V.pdf)**
2019-03-04 11:29:53 +01:00
2023-12-21 22:34:43 +01:00
* **Functions**: Pass by-value, Pass by-pointer, Pass by-reference, Function signature and Overloading, Overloading and `=delete` , Default parameters, Attributes `[[attributes]]`
2023-09-15 01:30:21 +02:00
* **Function Pointer and Function Objects**
2023-12-21 22:34:43 +01:00
* **Lambda Expressions**: Capture list, Parameters, Composability, `constexpr/consteval` , `template` , `mutable` , `[[nodiscard]]` , Capture list and classes
* **Preprocessing**: Preprocessors, Common errors, Source location macros, Conditional compiling macros, Stringizing operator (`#`), `#error` and `warning` , `#pragma` , Token-Pasting Operator (`##`), Variadic Macro
2018-03-08 12:04:09 +01:00
2023-11-20 21:43:18 +01:00
**[7. Object-Oriented Programming I - Class Concepts](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/07.Object_Oriented_I.pdf)**
2019-03-04 11:29:53 +01:00
2022-04-14 06:43:12 +02:00
* **C++ Classes**: RAII Idiom
2023-12-21 22:34:43 +01:00
* **Class Hierarchy**
* **Access specifiers**: Inheritance access specifiers, When use `public/protected/private` for data members?
2024-01-29 00:01:35 +01:00
* **Class Constructor**: Default constructor, Class initialization, Uniform initialization for objects, Delegate constructor, `explicit` keyword, `[[nodiscard]]` and classes
2021-03-04 22:54:21 +01:00
* **Copy Constructor**
* **Class Destructor**
2023-09-15 01:30:21 +02:00
* **Defaulted Constructors, Destructor, and Operators** (`= default`)
2021-03-04 22:54:21 +01:00
* **Class Keywords**: `this` , `static` , `const` , `mutable` , `using` , `friend` , `delete`
2019-03-04 11:29:53 +01:00
2023-11-20 21:43:18 +01:00
**[8. Object-Oriented Programming II - Polymorphism and Operator Overloading](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/08.Object_Oriented_II.pdf)**
2018-03-08 12:04:09 +01:00
2021-09-19 18:39:53 +02:00
* **Polymorphism**: `virtual` methods, Virtual table, `override` keyword, `final` keyword, Common errors, Pure virtual method, Abstract class and interface
2021-03-19 19:51:45 +01:00
* **Inheritance Casting and Run-time Type Identification**
2023-09-15 01:30:21 +02:00
* **Operator Overloading**: Overview, Comparison operator `<` , Spaceship operator `<=>` , Subscript operator `[]` , Multidimensional Subscript operator `[]` , Function call operator `()` , static operator `[]` and operator `()` , Conversion operator `T()` , Return type overloading resolution, Increment and decrement operators `++` /`--`, Assignment operator `=` , Stream operator `<<` , Operator Notes
2021-09-19 18:39:53 +02:00
* **C++ Special Objects**: Aggregate, Trivial class, Standard-layout class, Plain old data (POD), Hierarchy
2018-03-08 12:04:09 +01:00
2023-11-20 21:43:18 +01:00
**[9. Templates and Meta-programming I - Function Templates and Compile-Time Utilities](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/09.Templates_I.pdf)**
2018-03-08 12:04:09 +01:00
2023-12-21 22:34:43 +01:00
* **Function Template**: Overview, Template parameters, Template parameter - default value, Overloading, Specialization
2023-03-19 00:00:53 +01:00
* **Template Variable**
2023-09-15 01:30:21 +02:00
* **Template Parameter Types**: Generic Type Notes, `auto` Placeholder, Class template parameter type, Array and pointer types, Function type
2021-03-04 22:54:21 +01:00
* **Compile-Time Utilities**: `static_assert` , `decltype` Keyword, `using` Keyword
2023-03-19 00:00:53 +01:00
* **Type Traits**: Overview, Type traits library, Type manipulation
2018-03-08 12:04:09 +01:00
2023-12-21 22:34:43 +01:00
**[10. Templates and Meta-programming II - Class Templates and SFINAE](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/10.Templates_II.pdf)**
2018-03-08 12:04:09 +01:00
2024-01-17 01:58:44 +01:00
* **Class Template**: Class specialization, Class template constructor, Constructor template automatic deduction (CTAD)
2023-09-15 01:30:21 +02:00
* **Class Template - Advanced Concepts**: Class + Function - Specialization, Dependent Names - `typename` and `template` Keywords, Class template hierarchy and `using` , `friend` Keyword, Template Template Arguments
2021-03-04 22:54:21 +01:00
* **Template Meta-Programming**
* **SFINAE: Substitution Failure Is Not An Error**: Function SFINAE, Class SFINAE, Class + Function SFINAE
2023-03-19 00:00:53 +01:00
* **Variadic Template**: Folding Expression, Variadic class template
* **C++20 Concepts**: Overview, `concept` Keyword, `requires` Clause, `requires` Expression, `requires` Expression + Clause, `requires` Clause + Expression, `requires` and `constexpr` , Nested `requires`
2018-03-08 12:04:09 +01:00
2023-12-21 22:34:43 +01:00
**[11. Translation Units I - Linkage and One Definition Rule](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/11.Translation_Units_I.pdf)**
2018-03-08 12:04:09 +01:00
2021-09-19 18:39:53 +02:00
* **Basic Concepts**: Translation unit, Local and global scope, Linkage
2023-03-19 00:00:53 +01:00
* **Storage Class and Duration**: Storage duration, Storage class, `static` and `extern` keywords, Internal/External linkage examples
* **Linkage of `const` and `constexpr` **: Static Initialization Order Fiasco
* **Linkage Summary**
2022-04-23 21:27:55 +02:00
* **Dealing with Multiple Translation Units**: Class in multiple translation units
2023-03-19 00:00:53 +01:00
* **One Definition Rule (ODR)**: Global variable issues, ODR - Point 3, `inline` functions/variables, `constexpr` and `inline`
* **ODR - Function Template**: Cases, `extern` keyword
* **ODR - Class Template**: Cases, `extern` keyword
* **ODR Undefined Behavior and Summary**
2018-03-08 12:04:09 +01:00
2023-12-21 22:34:43 +01:00
**[12. Translation Units II - Include, Module, and Namespace](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/12.Translation_Units_II.pdf)**
2023-04-03 03:58:07 +02:00
- **`#include` Issues**: Forward declaration, Include guard, Circular dependencies, Common linking errors
2023-11-20 21:43:18 +01:00
- **C++20 Modules**: Overview, Terminology, Visibility and Reachability, Module unit types, Keywords, Global module fragment, Private module fragment, Header module unit, Module partitions
2023-04-03 03:58:07 +02:00
- **Namespace**: Namespace functions vs. `static` methods, Namespace alias, Anonymous namespace, `inline` namespace, Attributes and namespace
- **Compiling Multiple Translation Units**: Fundamental compiler flags, Compile Methods, Deal with libraries, Build static/dynamic libraries, Find dynamic library dependencies, Analyze object/executable symbols
2023-11-20 21:43:18 +01:00
**[13. Code Conventions](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/13.Code_Convention.pdf)**
2019-03-04 11:29:53 +01:00
2023-10-23 23:41:29 +02:00
* **C++ Project Organization**: Project directories, Project files, “Common” Project Organization Notes, Alternative - “Canonical” project organization
2021-03-04 22:54:21 +01:00
* **Coding Styles and Conventions**
2021-03-19 19:51:45 +01:00
* **`#include`**
2021-03-04 22:54:21 +01:00
* **Macro and Preprocessing**
* **Namespace**
2023-12-21 22:34:43 +01:00
* **Variables and Arithmetic Types**
2021-03-04 22:54:21 +01:00
* **Functions**
* **Structs and Classes**
2021-09-19 18:39:53 +02:00
* **Control Flow**
2021-03-04 22:54:21 +01:00
* **Modern C++ Features**
* **Maintainability**
2023-09-15 01:30:21 +02:00
* **Naming**
2023-11-20 21:43:18 +01:00
* **Readability and Formatting**
2021-03-04 22:54:21 +01:00
* **Code Documentation**
2018-03-08 12:04:09 +01:00
2023-12-21 22:34:43 +01:00
**[14. Ecosystem I - Debugging](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/14.Ecosystem_I.pdf)**
2019-03-04 11:29:53 +01:00
2023-03-19 00:00:53 +01:00
* **Debugging**
* **Assertion**
2023-12-21 22:34:43 +01:00
* **Execution debugging**: Breakpoints, Watchpoints / Catchpoints, Control Flow, Stack and Info, Print, Disassemble
2021-09-19 18:39:53 +02:00
* **Memory Debugging**: `valgrind` , Stack protection
* **Sanitizers**: Address sanitizer, Leak sanitizer, Memory sanitizers, Undefined behavior sanitizer
2021-03-04 22:54:21 +01:00
* **Debugging Summary**
2023-09-15 01:30:21 +02:00
* **Compiler Warnings**
* **Static Analysis**
2023-12-21 22:34:43 +01:00
* **Code Testing**: Unit test, Test-Driven Development (TDD), Code coverage, Fuzz testing
2021-03-04 22:54:21 +01:00
* **Code Quality**: `clang-tidy`
2018-03-08 12:04:09 +01:00
2023-12-21 22:34:43 +01:00
**[15. Ecosystem II - Cmake and Other Tools](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/15.Ecosystem_II.pdf)**
2023-04-03 03:58:07 +02:00
- **CMake**: `cmake` and `ctest`
- **Code Documentation**: `doxygen`
- **Code Statistics**: Count lines of code, Cyclomatic complexity analyzer
- **Other Tools**: Code formatting - `clang-format` , `Compiler Explorer` , Code transformation - `CppInsights` , Code autocompletion - `GitHub Co-Pilot/TabNine/Kite` , Local code search - `ripgrep` , Code search engine - `searchcode/grep.app` , Code benchmarking - `Quick-Bench` , Font for Coding
2023-11-20 21:43:18 +01:00
**[16. Utilities](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/16.Utilities.pdf)**
2020-04-06 12:47:46 +02:00
2021-03-04 22:54:21 +01:00
* **I/O Stream**: Manipulator, `ofstream/ifstream`
2023-11-20 21:43:18 +01:00
* **Strings**: `std::string` , Conversion from/to numeric values, `std::string_view` , `std::format` , `std::print`
2023-12-21 22:34:43 +01:00
* **Math Libraries**
2021-09-19 18:39:53 +02:00
* **Random Number**: Basic Concepts, C++ `<random>` , Seed, PRNG period and quality, Distribution, Quasi-random
* **Time Measuring**: Wall-Clock time, User time, System time
2024-01-17 01:58:44 +01:00
* **Std Class Templates**: `std::pair` , `std::tuple` , `std::variant` , `std::optional` , `std::any` , `std::stacktrace`
2021-09-19 18:39:53 +02:00
* **Filesystem Library**: Query methods, Modify methods
2020-04-06 12:47:46 +02:00
2023-11-20 21:43:18 +01:00
**[17. Containers, Iterators, and Algorithms](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/17.Iterators_Containers_Alg.pdf)**
2020-04-06 12:47:46 +02:00
2021-03-04 22:54:21 +01:00
* **Containers and Iterators**
* **Sequence Containers**: `std::array` , `std::vector` , `std::list` , `std::deque` , `std::forward_list`
2021-09-19 18:39:53 +02:00
* **Associative Containers**: `std::set` , `std::map` , `std::multiset`
2021-03-04 22:54:21 +01:00
* **Container Adaptors**: `std::stack` , `std::queue` , `std::priority_queue`
2021-09-19 18:39:53 +02:00
* **View**: `std::span`
2021-11-01 13:59:47 +01:00
* **Implement a Custom Iterator**: Semantic, Implement a simple Iterator
2022-10-23 04:15:16 +02:00
* **Iterator Utility Methods**: `std::advance` , `std::next` , `std::prev` , `std::distance` , Container access methods, Iterator traits
2021-03-04 22:54:21 +01:00
* **Algorithms Library**: `std::find_if` , `std::sort` , `std::accumulate` , `std::generate` , `std::remove_if`
2022-10-23 04:15:16 +02:00
* **C++20 Ranges**: Key concepts, Range view, Range adaptor, Range factory, Range algorithms, Range actions
2020-04-06 12:47:46 +02:00
2023-11-20 21:43:18 +01:00
**[18. Advanced Topics I](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/18.Advanced_Topics_I.pdf)**
2018-03-08 12:04:09 +01:00
2023-12-21 22:34:43 +01:00
* **Move Semantic**: `lvalues` and `rvalues` references, Move semantic, `std::move` , Class Declaration Semantic
2021-09-19 18:39:53 +02:00
* **Universal Reference and Perfect Forwarding**: Universal reference, Reference collapsing rules, Perfect forwarding
2021-03-04 22:54:21 +01:00
* **Value Categories**
2023-10-23 23:41:29 +02:00
* **`& `, `&&` Ref-qualifiers and `volatile` Overloading**
2021-03-04 22:54:21 +01:00
* **Copy Elision and RVO**
2023-03-19 00:00:53 +01:00
* **Type Deduction**: Pass by-reference, Pass by-pointer, Pass by-value, `auto` deduction
2021-03-04 22:54:21 +01:00
* **`const` Correctness**
2019-03-04 11:29:53 +01:00
2023-11-20 21:43:18 +01:00
**[19. Advanced Topics II](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/19.Advanced_Topics_II.pdf)**
2023-04-03 03:58:07 +02:00
2023-12-21 22:34:43 +01:00
- **Undefined Behavior:** Common cases, Detecting undefined behavior
2023-04-03 03:58:07 +02:00
- **Error Handling**: C++ Exceptions, Defining custom exceptions, `noexcept` keyword, Memory allocation issues, Alternative error handling approaches
- **C++ Idioms**: Rule of zero/three/five, Singleton, PIMPL, CRTP, Template Virtual Functions
- **Smart pointers**: `std::unique_ptr` , `std::shared_ptr` , `std::weak_ptr`
- **Concurrency**: Thread Methods, Mutex, Atomic, Task-based parallelism
2023-11-20 21:43:18 +01:00
**[20. Optimization I - Basic Concepts](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/20.Optimization_I.pdf)**
2022-06-24 08:01:49 +02:00
2023-10-23 23:41:29 +02:00
* **Introduction**: Moore’ s Law, Moore’ s Law limitations, Reasons for Optimizing
2022-06-24 08:01:49 +02:00
* **Basic Concepts**: Asymptotic complexity, Time-Memory Trade-off, Developing Cycle, Ahmdal's law, Throughput, Bandwidth, Latency, Performance bounds, Arithmetic intensity
2023-09-15 01:30:21 +02:00
* **Basic Architecture Concepts**: Instruction-level parallelism (ILP), Little’ s law, Data-level parallelism (SIMD), Thread-level parallelism (TLP), Single Instruction Multiple Threads (SIMT), RISC, CISC Instruction sets
2023-03-19 00:00:53 +01:00
* **Memory Hierarchy**: Memory hierarchy concepts, Memory locality
2022-06-24 08:01:49 +02:00
2023-11-20 21:43:18 +01:00
**[21. Optimization II - Code Optimization](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/21.Optimization_II.pdf)**
2019-03-04 11:29:53 +01:00
2023-03-19 00:00:53 +01:00
* **I/O Operations**: `printf` , Memory mapped I/O, Speed up raw data loading
2023-09-15 01:30:21 +02:00
* **Memory Optimizations**: Heap memory, Stack memory, Cache utilization, data alignment, Memory Prefetch
2023-03-19 00:00:53 +01:00
* **Arithmetic**: Data types, Operations, Conversion, Floating-point, Compiler intrinsic functions, Value in a range, Lookup table
2023-12-21 22:34:43 +01:00
* **Control Flow**: Loop hoisting, Loop unrolling, Branch hints `[[likely/unlikely]]` , Compiler hints `[[assume]]` , Recursion
2023-03-19 00:00:53 +01:00
* **Functions**: Function call cost, Argument passing, Function optimizations, Function inlining, Pointers aliasing
2023-12-21 22:34:43 +01:00
* **Object-Oriented Programming**
2023-09-15 01:30:21 +02:00
* **Std Library and Other Language Aspects**
2020-03-01 12:50:30 +01:00
2023-11-20 21:43:18 +01:00
**[22. Optimization III - Non-Coding Optimizations and Benchmarking](https://github.com/federico-busato/Modern-CPP-Programming/blob/master/22.Optimization_III.pdf)**
2020-03-01 12:50:30 +01:00
2023-10-23 23:41:29 +02:00
* **Compiler Optimizations**: About the compiler, Compiler optimization flags, Linker optimization flags, Architecture flags, Help the Compiler to produce better code, Profile guided optimization (PGO), Post-Processing Binary Optimizer
2024-01-24 19:04:42 +01:00
* **Compiler Transformation Techniques**: Basic Transformations, Loop unswitching, Loop fusion, Loop fission, Loop interchange, Loop tiling
2023-12-21 22:34:43 +01:00
* **Libraries and Data Structures**: External libraries
2023-10-23 23:41:29 +02:00
* **Performance Benchmarking**: What to test?, Workload/Dataset quality, Cache behavior, Stable CPU performance, Program, Multi-threads considerations, Program memory layout, Measurement overhead, Compiler optimizations, Metric evaluation
2021-03-04 22:54:21 +01:00
* **Profiling**: `gprof` , `uftrace` , `callgrind` , `cachegrind` , `perf` Linux profiler
2021-09-19 18:39:53 +02:00
* **Parallel Computing**: Concurrency vs. Parallelism, Performance scaling, Gustafson’ s Law, Parallel programming languages
2021-03-04 22:54:21 +01:00
2021-11-01 13:59:47 +01:00
### Roadmap
2022-10-23 04:15:16 +02:00
1. Software Design Chapter
2. Build Aspects Chapter (e.g. reducing build time)
2021-11-01 13:59:47 +01:00
2022-04-14 06:43:12 +02:00
### Essential Tool
2021-03-04 22:54:21 +01:00
Online compiler and execution: [CompilerExplorer ](https://godbolt.org/ )
* for code execution: [Add new..] -> [execution only]
2018-03-08 12:04:09 +01:00
2023-12-03 01:54:13 +01:00
### Reporting bugs 🐛 and contributing
If you find any typo, conceptual error, or section to improve, please report them by using the `issue` panel.
2018-03-08 12:04:09 +01:00
2022-04-14 06:43:12 +02:00
## Author
2018-03-08 12:04:09 +01:00
2024-02-08 07:28:28 +01:00
`Federico Busato` , https://federico-busato.github.io/
2021-05-20 13:12:28 +02:00
2021-11-01 13:59:47 +01:00
- Twitter: [twitter.com/fedebusato ](https://twitter.com/fedebusato )
2023-11-20 21:43:18 +01:00
- LinkedIn: [www.linkedin.com/in/federico-busato/ ](https://www.linkedin.com/in/federico-busato/ )