Skip to content

Releases: federico-busato/Modern-CPP-Programming

v1.8.0

08 Nov 06:00
Compare
Choose a tag to compare

The soul of this release is the full refactoring and updating of the "Code Conventions" chapter:

  • All code conventions have been reviewed again, adding missing items and improving the organization of the existing ones
  • "Core C+"+ code convention has been fully added
  • Mentioned code convention tools like clang-tidy
  • All bullet points now have links to the official convention descriptions
  • The chapter has been split into two lectures and organized into several subsections to improve the readability

Introduction:

  • Updated main charts: "C++ popularity" and "compute-trend"

Preparation:

  • Books updated: "Professional C++", "Programming and Principles using C++"

Basic Concepts II:

  • Improved "Integral data type" section: description of ptrdiff_t, added uintptr_t, added hardware relation with integral arithmetic
  • Added saturation arithmetic functions C++26 for integral data types
  • Improved signed integer and bitwise operations description

Basic Concepts III:

  • Added C++ attributes section
  • Moved "namespace" section here and added improvements: using namespace, using declaration in details
  • Added alternative syntax for namespace
  • Added an example of "using enum" pre-C++20

Basic Concepts IV:

  • Fixed "constexpr Function - Limitations" and minor section improvements
  • Described the relation between constexpr function and argument lifetime
  • Better explanation and more examples for static_cast, reinterpret_cast, const_cast, bit_cast
  • Added narrow_cast and "uniform initialization cast"
  • Mentioned the behavior of auto within structures
  • Mentioned the behavior of constexpr and structure binding
  • Described volatile deprecation in C++20
  • Moved pointer description before "Heap and Stack"
  • Added C++23 type safe placement allocation function

Basic Concepts V:

  • Added "Boost Predef" library reference for common macros
  • Added template lambda emulation
  • Added an example of template lambda without automatic deduction
  • Added the relation between lambda expression and function
  • Described recursive lambda and lambda within another lambda
  • Added C++23 lambda expressions with optional parameters
  • Reported GCC 14 flag -fdiagnostics-all-candidates

Object-Oriented Programming II:

  • Improved Polymorphism introduction and added "C++ Mechanisms for Polymorphism"

Template and Metaprogramming II:

  • Added -Wfatal-errors to "Template Debugging" section

Translation Units II:

  • Improved C++ libraries section. Clarified building steps, environment variables, usage, and ABI
  • Small improvements in the "compiling multiple translation units" section

Debugging:

  • Added Boost::Assert and Boost::stacktrace to assertion section
  • Added GWPSan Sampling-based Sanitizer
  • Added additional compiler flags to help debugging

Ecosystem:

  • Updated the "AI-Powered Code Completion" tools
  • Books updated

Utilities:

  • Added a section for random number generator for "Recent Algorithms and Performance"
  • Improved the seed generation section

Advanced Topics I:

  • Fixed type deduction example for array

Optimization I:

  • Added new references in the "Introduction" section
  • Improved "Arithmetic Intensity" section

Optimization II:

  • Added a few notes about loop optimization
  • Improved memory alignment section and added C++20 std::assume_aligned
  • Fixed C++17 alignment function and added an example
  • Updated pragma unroll compiler support
  • Added a new reference for hash table comparison
  • Added MSVC forceinline attribute and adopted C++11 syntax

Optimization III:

  • Added official link to LLVM Bolt project and a new benchmark
  • Added a benchmark for "Polyhedral Optimizations"
  • Added -fprefetch-loop-arrays optimization flag
  • Added userspace governor setting for cpu frequency
  • Added "Hash-prospector" as replacement for PRNG
  • Added optimized linear and binary search in "External libraries" section
  • Added target and target_clones function attributes

Software Design I:

  • Refactored "Member Functions vs. Free Functions" -> "Class Design"

Thanks for all feedback and contributions: @FisherKKK, @JDRanpariya, @YueLu0116, @luck-tian, @D4arkShad0w, @DYNIO1999, @saveasguy, @leofracca, @Dong-kyu-Lee, @ChoiSeonMun, @viktorteren, @ChoiSeonMun, @Mati-as, @RuimingShen, @abzrg, @xintin, @russkel, @binary-manu

v1.7.0

31 Mar 00:12
Compare
Choose a tag to compare

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

v1.6.0

21 Dec 21:45
Compare
Choose a tag to compare

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

v1.5.0

20 Nov 20:47
Compare
Choose a tag to compare

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:

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

v1.4.3

23 Oct 21:45
Compare
Choose a tag to compare

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

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

v1.4.2

14 Sep 23:37
Compare
Choose a tag to compare

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)

v1.4.1

15 Jul 22:15
Compare
Choose a tag to compare

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

v1.4.0

03 Apr 02:04
Compare
Choose a tag to compare
  • Split "Translation Units", "Ecosystem", and "Advanced Concepts" chapters for better readability
  • Added 8-bit floating-point to "Basic Concepts I"

v1.3.0

18 Mar 23:07
Compare
Choose a tag to compare

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

23 Oct 02:18
Compare
Choose a tag to compare

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