Modern CPP Programming Versions Save

Modern C++ Programming Course (C++03/11/14/17/20/23/26)

1.7.0

1 month ago

A huge thank you to all the contributors who are helping to make this course better and better day by day: @jakeheke75, @guoci, @leofracca, @ChenMiaoi, @AlanDeSmet, @indraneel-mondal, @Yuppdivyaj, @BiradarMayur2509, @Ali-Sda, @eltociear, @freakynit, @Wheest, @VaibhavSaraf, @LuccaT95, @ilovexyz, @kushnaryo8, @liyixin123, @Ingerdev, @eugenefil, @binary-manu, @dijkstracula, @arnimarj

General Improvements:

  • Subsections now point to the right page
  • Switched to TexLive2024
  • Moved the first part of Basic Concepts I in a new lecture "Preparation"
  • Provided the first draft of "Software Design" lectures

Introduction:

  • Updated the book section
  • Added language performance benchmarking
  • Added a new quote on learning
  • Added new references to Rust, including "Secure by Design: Google’s Perspective on Memory Safety"
  • Added Cobol example to "Why Switching to a New Language is Hard?"

Preparation:

  • Added the Zed editor
  • Added C++23/26 compiler flags

Basic Concepts I:

  • Added a new section about the C++ type system
  • Minor improvements for the "Fundamental Types" section

Basic Concepts II:

  • Added a couple of undefined behavior examples for integral types
  • Added a new example of mixing signed/unsigned error (Chandler Carruth, CppCon 2016)
  • Described the special value behavior for floating-point
  • Added floating-point undefined behavior
  • Slightly expanded the floating-point arithmetic properties section

Basic Concepts III:

  • Added a [[deprecated]] attribute section
  • Added C++26 auto _ unused variable

Basic Concepts IV:

  • Improved initialization section, especially brace-initialization
  • Added an example of undefined behavior for initialization
  • Described undefined behavior for pointer arithmetic
  • Improved the "sizeof" section
  • Described the [[no_unique_address]] section
  • Improved constexpr limitations section
  • Added static keyword within constexpr functions C++23

Basic Concepts V:

  • Added another examples of common macro problems

Object-Oriented Programming I:

  • Slightly improved the copy constructor introduction

Object-Oriented Programming II:

  • Improved "Object Layout" section

Templates and Meta-Programming I:

  • Added C++26 static_assert with formatting
  • Improved "Implicit Template Instantiation" section, thanks to @gouci
  • Added a subsection related to "Template Instantiation"

Templates and Meta-Programming II:

  • Improved the "variadic template" section + two more examples
  • Added an example of variadic template applied to types
  • Added two notes about function SFINAE limitations
  • Removed "Class + Function" SFINAE
  • Improved CTAD introduction

Debugging and Testing (previously Ecosystem I):

  • Improved "Undefined Behavior Sanitizer" section
  • Created a new section "Hardening Techniques"
  • Added compiler warnings for Windows
  • Improved the "static analysis" section and added msvc /analyse
  • Added a new example of Cost of Software Defects
  • Minor improved to the "Program Errors" section

Ecosystem:

  • Removed Kite
  • Added ugrep

Code Conventions:

  • Improved the Naming section
  • Described how to use clang-tidy to enforce a naming style
  • Reorganized code convention list
  • Added a personal comment on West/East notation

Utilities:

  • Move std::span to this lecture
  • Improved the "Time Measuring" section

Iterators, Containers, and Algorithms:

  • Added a common error of iterator usage

Advanced Concepts I:

  • Improved the "Undefined Behavior" section

Advanced Concepts II:

  • Added Trivial infinite loop undefined behavior
  • Added the reference "Enumerating Core Undefined Behavior"
  • Added "Return Code", "Return Code and Exception Summary", and "std::expected" to "Recoverable Error Handing" section

Performance Optimizations I:

  • Reformulated the "Basic Architecture Concepts" section
  • Added "core-to-core latency and threads affinity" section
  • Added Poisson solver complexity over time in the Moore's Law Limitations section
  • Added Arm64 cache line size
  • Added "Memory Ordering Model" section

Performance Optimizations II:

  • Better explanation of loop unswitching
  • Added assertion optimization example
  • Improved data alignment section
  • Better explanation of signed integer optimization and added an example
  • Added a note related to stack data structure
  • Improved function attribute section
  • Improved function call section

Performance Optimizations III:

  • Added ARM reference for BOLT optimization
  • Added -fopt-info to compiler optimization flags
  • Added -fassociative-math to floating point optimization flags
  • Added Abseil and Frozen to std data structures replacement

1.6.0

4 months ago

First of all, THANK YOU TO EVERYONE FOR YOUR INTEREST IN THIS COURSE. In the last few weeks, the course jumped from 1K to 7.6K stars ✨ 🙏

Credit to @kimsoohwan, @Zitrax, @f9rocket, @saw-lau, @mostafacs, @platypusguy, @raymondmdang, @jesustorresdev, @HaloWang, @66hash, @abzrg, @csukuangfj, @jakeheke75, @amirkhaki, @fabrizio-ottati, @dsardelic, @akobyl for pointing me out several mistakes and typos

Introduction:

  • Add a new section for C++ alternatives: Rust, Zig, Why switching to a new language is hard?
  • Moved books to the related sections
  • Updated and simplified "Who I Am" section

Basic Concepts I:

  • Added emacs, helix, lapce, neovim editors
  • Added IEEE 128/256-bit floating point formats
  • Added std::print
  • Added text version of logical operators

Basic Concepts II:

  • Improved unsigned/signed section
  • Improved C++ Data Model section

Basic Concepts III:

  • Minor improvements to "Declaration/Definition" section

Basic Concepts IV:

  • Improved "Source Location Macros" section
  • Improved "Avoid Unused Variable Warning" section

Basic Concepts V:

  • Minor improvements to Function Attributes
  • Better explanation and separation of "Source Location Macros" section

Object-Oriented Programming I:

  • Improved "const keyword" section

Templates and Meta-programming II:

  • Added "Constructor Template Automatic Deduction (CTAD)" section

Code Conventions:

  • Added Marissa Mayer quote
  • Added some notes about code verbosity
  • Separated "Use fixed-width integer type rule" between Google and Unreal

Ecosystem I:

  • Added new memory vulnerability references
  • Added "Modern CMake for C++" book

Utilities:

  • Added std::stacktrace library
  • Removed std::byte

Containers, Iterators, Ranges, and Algorithms:

  • Moved "Iterator categories" in the introduction for a better overview

Optimizations I:

  • Added "Sqrt(N) for memory latency" notes

Optimizations II:

  • Better description of vectorization and =default

1.5.0

5 months ago

Split "Basic Concepts I" into two sets of slides to better separate the topics and improve the readability.

Basic Concepts II:

  • Added a new reference on how to compare signed and unsigned integers in C++20
  • Added a new reference for posit representation
  • Added a new reference for microscaling MX floating point formats

Object Oriented Programming II:

  • fix typo related to swap semantic #11 . Thanks to @kimsoohwan

Code Conventions:

  • Minor improvements to "macro and preprocessing" section
  • Added Std naming convention where missing
  • Improve "brace initializer list" section

Performance Optimziation II:

  • Improved Functions inlining section, added relation with linkage

1.4.3

6 months ago

Basic Concepts I

  • Improved Operators Precedence Table
  • Minor improvements for floating point section

Basic Concepts III

  • Added if constexpr pitfalls
  • Added volatile keyword
  • Improved struct and union section
  • Fixed C++17 out-of-range assignment to enum

Basic Concepts IV

  • Fixed typos #10, thanks to @kimsoohwan

Object Oriented I

  • Added physical vs. logical state notes of struct/class
  • Improved Access specifiers section
  • Simplified the ''Most Vexing Parse" problem section

Object Oriented II

  • Improve overview of operator overloading

Translation Units II

  • Typo fixing

Code Convention

  • Reorganized/improved Project Organization section
  • Added references to column limit note

Ecosystem I

  • Added Unit/Functional test explanation

Advanced Topics I

  • Improved ref-qualifiers overloading section + volatile overloading

Advanced Topics II

  • Improved undefined behavior section and added examples of Function evaluation ordering and Signed overflow

Optimization I

  • Added Moore's Law Limitations and refactoring

Optimizations II

  • Improved Operations section, add logic vs. bitwise evaluation

Optimization III

  • Improved cache behavior section
  • Added multi-threads considerations
  • Improved benchmarking section: added Instruction order issue and actual values vs. power consumption
  • Improved optmization flags section: added windows equivalent, -Oz, -mfma, instruction set flags
  • Added -fno-signaling-nans

1.4.2

7 months ago

Basic Concepts I

  • Added C++23 floating-point types: range, suffix, prefix
  • Added ptrdiff_t
  • Minor improvements

Basic Concepts II

  • Minor improvements

Basic Concepts III

  • Added West, East notation for const
  • Improved constexpr section and explained the behavior of the keyword within a structure
  • Added C++23 if consteval

Basic Concepts IV

  • Added Overloading and =delete section
  • Added consteval lambda example
  • Added [[nodiscard]] attribute
  • Added C++23 conditional preprocessing

Object-Oriented Programming I

  • Added "Defaulted Constructors, Destructor, and Operators" section

Object-Oriented Programming II

  • Added C++23 Multidimensional Subscript Operator
  • Added C++23 static operator()

Templates and Metaprogramming I

  • Improved using keyword section
  • Simplified the type traits section

Templates and Metaprogramming II

  • Minor improvements

Code Conventions

  • Minor improvements

Ecosystem I

  • Improved debugging introduction including the explanation of "Errors, Defects, and Failures", "Cost of Software Defects", "Types of Software Defects"

Ecosystem II

  • Added hypergrep tool

Utilities

  • Added C++23 std::print
  • Removed redundant code

Advances Topics II

  • Added dangling reference undefined behavior

Performance Optimizations I

  • Update Memory Hierarchy numbers
  • Update Memory Hierarchy figure

Performance Optimizations II

  • Added C++23 std::unreachable()
  • Added "Std Library and Other Language Aspects" section (partially moved from Optimizations III)

1.4.1

9 months ago

Basic Concepts I

  • Fixed char properties in C++11 #8
  • Minor improvements in the undefined behavior section

Basic Concepts III

  • Added a note to highlight that arrays of size 0 are not allowed by the standard (except gcc)

Object-Oriented Programming I

  • Improved explicit keyword section

Translation Units I

  • Improved Linkage Summary section

Code Convention

  • Improved and refactoring the sections Maintainability, Naming, Readability and Formatting

Ecosystem I

  • Improved gdb info command description
  • Added _FORTIFY_SOURCE=3 in stack protection section
  • Improved Unit Testing introduction
  • Add Test-Driven Development description
  • Extended Code Coverage to llvm-lcov

Optimization I

  • Added apollo computer vs. usb-c comparison
  • Add Single Instruction Multiple Threads (SIMT) section
  • Added Jonh Carmark note about memory hierarchy

Optimization II

  • Added Memory Prefetch section

Thanks to @marcobergamin

1.4.0

1 year ago
  • Split "Translation Units", "Ecosystem", and "Advanced Concepts" chapters for better readability
  • Added 8-bit floating-point to "Basic Concepts I"

v1.3.0

1 year ago

List of changes:

Introduction:

  • Updated C++ timeline, Tiobe index, Redmonk index
  • Improved "Why C++ is so Popular?"
  • Added "C++ Weakness" section
  • Update/fixed book references
  • Added course slide legend

Basic Concepts I:

  • Added NASA PI note
  • Fixes #5 (used ! as escape char)

Basic Concepts II:

  • Fixes #6 (wrong array size)

Basic Concepts III:

  • Fixes malloc returns NULL for zero-size allocations
  • Added "Non-Allocating Placement section", "Non-Throwing Allocation", "Constants and Literals" sections
  • Refactored "Structure Initialization"
  • Add a note for virtual + constexpr usage in C++20

Basic Concepts IV:

  • Fixed #6, wrong lambda return

Object-Oriented Programming I:

  • Moved struct initialization to "Basic Concepts III"
  • Improved = default implications
  • Improved/refactored static keyword section

Object-Oriented Programming II:

  • Fixes #6, downcast variables

Template and Meta-programming I:

  • Refactoring, especially "Template Parameter Types"

Template and Meta-programming II:

  • Improved "Template Class Constructor" section

Translation Units:

  • Added "Linkage of const and constexpr variables" section
  • Simplified "Linkage Summary"
  • Better explanation of ODR - Point 3 with improved inline, template, constexpr descriptions

C++ Ecosystem:

  • Added a quote about maintenance effort
  • Updated valgrind version
  • Removed gcc detailed warnings section

Advanced Topics:

  • Improve "Universal reference" section
  • Minor fixes for "Smart pointer" section

Performance Optimization I:

  • Added John Carmak note
  • Added "page thrashing" description
  • Moved "Spatial Locality" and "Temporal Locality" details to Performance Optimization II

Performance Optimization II:

  • Added "Compiler Hints - [assume]
  • Minor improvements to "Arguments passing" section
  • Added __attribute__(pure) and __attribute__(const) descriptions
  • Added a few notes to "Object Dynamic Behavior Optimizations", e.g. virtual implications

Performance Optimization III:

  • Minor improvements to "Help the Compiler to Produce Better Code"
  • Added "Post-Processing Binary Optimizer" section

v1.2.0

1 year ago

Major changes:

  • Added C++20 Concepts section
  • Added C++20 Modules section
  • Added C++20 Ranges section
  • Added Metric Evaluation section (Performance Optimization III)

Other changes:

  • Basic Concept I: Added C++20 Safe Comparison Operators
  • Basic Concept II: Improved enum class features section
  • Basic Concept III: Improved Allocation/Deallocation Properties section
  • Basic Concept IV: Added [[maybe_unused]] attribute
  • Object-Oriented Programming I: Added [[nodiscard]] and Classes section
  • Object-Oriented Programming II: Improved Aggregate section
  • Templates and Meta-Programming I: Fixed decltype behavior
  • Translation Units: Introduced Attributes for Namespace
  • Ecosystem: Added GitHub Copilot

v1.1.0

1 year ago

Soul: Extended and split "Optimization I" slides Ecosystem: - added a few references Optimization I - greatly improved memory hierarchy section - added references and applied many fixes - added single-Thread Performance Trend - rewrote Ahmdal's law section - removed roofline model & bitmask slide