惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Engineering at Meta
Engineering at Meta
博客园 - 三生石上(FineUI控件)
The GitHub Blog
The GitHub Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Schneier on Security
Vercel News
Vercel News
A
Arctic Wolf
G
Google Developers Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
雷峰网
雷峰网
AWS News Blog
AWS News Blog
V
Visual Studio Blog
Cyberwarzone
Cyberwarzone
爱范儿
爱范儿
博客园 - 司徒正美
NISL@THU
NISL@THU
N
News | PayPal Newsroom
N
News and Events Feed by Topic
Scott Helme
Scott Helme
I
InfoQ
Project Zero
Project Zero
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
Tenable Blog
Help Net Security
Help Net Security
D
Docker
IT之家
IT之家
人人都是产品经理
人人都是产品经理
C
Cisco Blogs
Cisco Talos Blog
Cisco Talos Blog
PCI Perspectives
PCI Perspectives
aimingoo的专栏
aimingoo的专栏
博客园 - Franky
G
GRAHAM CLULEY
阮一峰的网络日志
阮一峰的网络日志
T
The Exploit Database - CXSecurity.com
Recent Announcements
Recent Announcements
博客园 - 【当耐特】
L
LINUX DO - 热门话题
J
Java Code Geeks
C
Cyber Attacks, Cyber Crime and Cyber Security
GbyAI
GbyAI
Google DeepMind News
Google DeepMind News
The Hacker News
The Hacker News
H
Hacker News: Front Page
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
SecWiki News
SecWiki News
T
Tailwind CSS Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
罗磊的独立博客

Hacker News: Front Page

SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads GitHub - GainSec/AutoProber: Hardware hacker’s flying probe automation stack for agent-driven target discovery, microscope mapping, safety-monitored CNC motion, probe review, and controlled pin probing. Introducing Claude Opus 4.7 Qwen Studio The Future of Everything is Lies, I Guess: Where Do We Go From Here? GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh Virginia Bans Sale of Geolocation Data Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis Ancient DNA reveals pervasive directional selection across West Eurasia [pdf] AI cybersecurity is not proof of work Moving a large-scale metrics pipeline from StatsD to OpenTelemetry / Prometheus GitHub - Nightmare-Eclipse/RedSun: The Red Sun vulnerability repository GitHub - SethPyle376/hiraeth: Local AWS emulator focused on fast integration testing, with SQS support, SQLite-backed state, and a debug-friendly web UI. A Better Ludum Dare; Or, How to Ruin a Legacy GitHub - macOS26/Agent: Any AI, replaces Claude Code, Cursor, OpenClaw. Over 18 LLM providers (Claude, OpenAI, Gemini, Ollama, Zai, HF, Qwen) wired into a native Mac app that writes code, builds Xcode projects, bumps versions, manages git, automates Safari, use AppleScript, JS or Accessibility, extend Agent! w/ MCP Servers, run tasks from your iPhone via Messages. YouTube now lets you turn off Shorts I Made a Terminal Pager Burgers | マクドナルド公式 Commands — HackerNews CLI documentation ChatGPT for Excel PiCore - Raspberry Pi Port of Tiny Core Linux Live Nation illegally monopolized ticketing market, jury finds Google Broke Its Promise to Me. Now ICE Has My Data. Founding Engineer at Adaptional | Y Combinator CRISPR takes important step toward silencing Down syndrome’s extra chromosome GitHub - saffron-health/libretto: The AI toolkit for building reliable browser automations US v. Heppner (S.D.N.Y. 2026) no attorney-client privilege for AI chats [pdf] Unexpected €54k billing spike in 13 hours: Firebase browser key without API restrictions used for Gemini requests Fragments: April 14 Cal.com Goes Closed Source: Why AI Security Is Forcing Our Decision | Cal.com - Scheduling Software for Online Bookings Laravel raised money and now injects ads directly into your agent Codex Hacked a Samsung TV Tech Valuations Back to Pre-AI Boom Levels A perfectable programming language — Soter GitHub - halfwhey/claudraband: Claude Code for the Power User Partnership through Play: Investigating How Long-Distance Couples Use Digital Games to Facilitate Intimacy Textbooks and Methods of Note-Taking in Early Modern Europe (2008) Eternity in six hours: Intergalactic spreading of intelligent life (2013) Seven countries now generate 100% of their electricity from renewable energy Tell HN: OpenAI silently removed Study Mode from ChatGPT Pro Max 5x Quota Exhausted in 1.5 Hours Despite Moderate Usage Show HN: Oberon System 3 runs natively on Raspberry Pi 3 (with ready SD card) Tell HN: docker pull fails in spain due to football cloudflare block Bring Back Idiomatic Design No one owes you supply-chain security GitHub - xsawyerx/curl-doom: DOOM, played over cURL Apple update turns Czech mate for locked-out iPhone user The Grand Line Cache TTL silently regressed from 1h to 5m around early March 2026, causing quota and cost inflation Building a Z-Machine in the worst possible language The peril of laziness lost Iran war: We spoke to the man making Lego-style AI videos that experts say are powerful propaganda AI Will Be Met With Violence, and Nothing Good Will Come of It GitHub - duguyue100/midnight-captain: Inspired by Midnight Commander, tailored to my taste. How to build a `git diff` driver · Jamie Tanna | Software Engineer Center for Responsible, Decentralized Intelligence at Berkeley The Local Universe’s Expansion Rate Is Clearer Than Ever, but Still Doesn’t Add Up - A new synthesis of astronomical measurements confirms a persistent mismatch that could point to physics beyond current models The disturbing white paper Red Hat is trying to erase from the internet – OSnews NetBlocks (@netblocks@mastodon.social) The Future of Everything is Lies, I Guess: Annoyances ‘Abhorrent’: the inside story of the Polymarket gamblers betting millions on war Productive procrastination — Max van IJsselmuiden maps, territory and LMs 447 Terabytes per Square Centimetre at Zero Retention Energy: Non-Volatile Memory at the Atomic Scale on Fluorographane Show HN: Pardonned.com – A searchable database of US Pardons 20 Years on AWS and Never Not My Job The Seasons are Wrong The FAA wants gamers to apply for air traffic control jobs Artemis II crew splashes down near San Diego after historic moon mission Why weekends are under threat We gave an AI a 3 year retail lease in SF and asked it to make a profit | Andon Labs How a dancer with ALS used brainwaves to perform live On filing the corners off my MacBooks Installing every* Firefox extension OpenClaw’s memory is unreliable, and you don’t know when it will break Steve Blank Nowhere Is Safe Chimpanzees in Uganda locked in vicious 'civil war', say researchers watgo - a WebAssembly Toolkit for Go linux/Documentation/process/coding-assistants.rst at master · torvalds/linux GitHub - callumlocke/json-formatter: Makes JSON easy to read. Founding Product Engineer at Bild AI | Y Combinator A compelling title that is cryptic enough to get you to take action on it GitHub - Keychron/Keychron-Keyboards-Hardware-Design: Industrial design files for Keychron keyboards and mice. 100+ models with CAD assets in STEP, DXF, DWG, and PDF. Source-available, with commercial use allowed for original compatible accessories within the license terms. [ANNOUNCE] WireGuardNT v0.11 and WireGuard for Windows v0.6 Released 1D-Chess Helium Is Hard to Replace Keeping a Postgres queue healthy — PlanetScale Serenity Forge (@serenityforge.com) Our response to the Axios developer tool compromise Do Americans read print books, e-books or audiobooks more? Uncharted island soon to appear on nautical charts The Problem That Built an Industry Fragments: April 2 Python Release Python install manager 26.1 Bitcoin miners are losing $19,000 on every BTC produced as difficulty drops 7.8% God sleeps in the minerals Harness engineering: leveraging Codex in an agent-first world Apple Silicon and Virtual Machines: Beating the 2 VM Limit What have been the greatest intellectual achievements? The APL Programming Language Source Code
GitHub - federico-busato/Modern-CPP-Programming: Modern C++ Programming Course (C++03/11/14/17/20/23/26)
KnuthIsGod · 2026-05-03 · via Hacker News: Front Page

C++03 / C++11 / C++14 / C++17 / C++20 / C++23 / C++26

This open-access course is directed at those who are already familiar with C and object-oriented programming aiming for 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
  • 29 lectures, 2000+ slides
  • Includes the latest language standard concepts and features
  • Practical teaching: non-verbose, short structured descriptions associated with code
  • 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 a software engineer

If you enjoy the course or you find it useful, please add a Star

stars - Modern-CPP-Programming

Roadmap:

  1. Move from Latex to Typst.
  2. Fully-open source the material and allow direct contribution.

Table of Contents

CHAPTERS

# TITLE MAIN FOCUS
1 Introduction (html) History of C/C++, Areas of applications, Course introduction
2 Preparation (html) Books, How to compile, Hello world
3 Basic Concepts I (html) Type System, Fundamental types, and Operators
4 Basic Concepts II (html) Integral types and arithmetic
5 Basic Concepts III (html) Floating-point types and arithmetic
6 Basic Concepts IV (html) Entities, Enumerators, Structures, Control flow statements
7 Basic Concepts V (html) Heap, Stack, Pointers, References, Const properties, Conversion operators
8 Basic Concepts VI (html) Functions, Lambda expressions, Preprocessing directives
9 Object-Oriented Programming I (html) Class hierarchy, Constructor, Destructor, Class keywords
10 Object Oriented Programming II (html) Polymorphism, Operators overloading
11 Templates and Meta-programming I (html) Function template, Type traits, Compile-time utilities
12 Templates and Meta-programming II (html) Class template, SFINAE
13 Translation Units I (html) Linkage and One Definition Rule
14 Translation Units II (html) Dealing with multiple translation units and files,#include, Modules
15 Code Conventions I (html) Project organization, Code conventions intro, Entities conventions
16 Code Conventions II (html) Template, Namespace, Modern C++, Maintainability, Naming, and Formatting conventions
17 Debugging and Testing (html) Execution/memory debugging, Sanitizers, Hardening techniques, Unit tests, Test-Driven Development
18 Ecosystem (html) Cmake, Documenting, and Other Tools
19 Utilities (html) Main std libraries
20 Containers, Iterators, and Algorithms (html) Containers, Iterators, Algorithms, Ranges
21 Advanced Topics I (html) Move semantics, Universal reference, Type deduction
22 Advanced Topics II (html) Error handling, C++ idioms, Smart pointers
23 Performance Optimizations I (html) Amdahl's Law, Performance bounds, Architecture concepts (ILP, SIMD, etc.), Memory hierarchy
24 Performance Optimizations II (html) Arithmetic optimizations, Memory optimizations, etc.
25 Performance Optimizations III (html) Compiler optimizations, Profiling, Benchmarking tools
26 Software Design I (html) Basic Concepts, Principles, Use cases
27 Software Design II (html) Design Patterns and Idioms
28 Binary Size (html) Binary size aspects
29 Build Time (html) Build time aspects

ALL-IN-ONE BOOK: modern-cpp.pdf (could be a few commits behind), html

TOPICS IN DETAILS

1. Introduction

  • A Little History of C/C++ Programming Languages.
  • Areas of Application and Popularity.
  • C++ Philosophy.
  • C++ Weakness: C++ alternatives, Why switching to a new language is hard?.
  • The Course.

2. Preparation

  • Books and References.
  • Slide Legend.
  • What Editor/ IDE/Compiler Should I Use?.
  • How to compile?.
  • Hello World: I/O Stream.

3. Basic Concepts I - Type System, Fundamental Types, and Operators

  • The C++ Type System: Type categories, Type properties.
  • C++ Fundamental Types Overview: Arithmetic types, Non-standard arithmetic types, void type, nullptr.
  • auto Keyword.
  • C++ Operators: Operators precedence, Prefix/Postfix increment/decrement semantic, Assignment, compound, and comma operators, Spaceship operator <=>.

4. Basic Concepts II - Integral Types

  • Integral Data Types: Suffix and Prefix, Fixed width integers, size_t, ptrdiff_t, uintptr_t.
  • Arithmetic Operation Semantics: Saturation Arithmetic.
  • Integer Undefined behavior: Signed overflow, Other cases.
  • Integer Conversion Rules: Same size conversion, Integer conversion rule, Arithmetic operation promotion rules, Safe comparison functions, Arithmetic operation special cases.

5. Basic Concepts III - Floating-point Types

  • Floating-point Types: Suffix, IEEE Floating-point standard and other representations, Normal/Denormal values, Infinity, Not a Number (NaN), Machine Epsilon, Units at the Last Place (ULP), Cheatsheet, Limits and useful functions, Arithmetic properties, Special values behavior, Undefined behavior, Detect floating-point errors.
  • Floating-point Issues: Catastrophic cancellation, Floating-point comparison.

6. Basic Concepts IV - Entities and Control Flow

  • Entities.
  • Declaration and Definition.
  • Enumerators.
  • struct, Bitfield, union: struct, Anonymous and unnamed struct, Bitfield, union.
  • Control Flow: if statement, for and while loops, Range-based for loop, switch, Initializing statement, goto, Avoid unused variable warning.
  • Namespace: Explicit global namespace, namespace alias, using-declaration, using namespace-directive, inline namespace.
  • Attributes: [[nodiscard]], [[indeterminate]], [[maybe_unused]], [[deprecated]], [[noreturn]].

7. Basic Concepts V - Memory Concepts

  • Pointers: Pointer operations, Address-of operator &, struct member access, void pointer, Pointer conversion, Pointer arithmetic, Wild and dangling pointers.
  • Fixed-size Array.
  • References.
  • Heap and Stack: Stack memory, new, delete, Non-allocating placement allocation, Non-throwing allocation, Memory leak.
  • Initialization: Variable initialization, Uniform initialization, Array initialization, Structure initialization, Structure binding, Dynamic memory initialization.
  • Const and Constant Expressions: Constants and literals, const, constexpr, constexpr Variables, constexpr Functions, constexpr objects, consteval, constinit.
  • Conditional Constant Expressions:
  • if constexpr, std::is constant evaluated(), if consteval.
  • volatile Keyword.
  • Explicit Type Conversion: static_cast, const_cast, reinterpret_cast, Type punning, std::bit_cast, Uniform initialization conversion, gls::narrow_cast.
  • sizeof and alignof Operators: sizeof, alignof, sizeof/alignof operator applied to struct, [[no_unique_address]].

8. Basic Concepts VI - Functions and Preprocessing

  • Functions: Pass by-value, Pass by-pointer, Pass by-reference, Function signature and overloading, Overloading and =delete, Default parameters.
  • Function Pointer and Function Objects.
  • Lambda Expressions: Capture list, Lambda expression and function relation, Parameter notes, Composability, Recursion, constexpr/consteval, template, mutable, 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.

9. Object-Oriented Programming I - Class Concepts

  • C++ Classes: RAII idiom.
  • Class Hierarchy.
  • Access specifiers: Inheritance access specifiers, When use public/protected/private for data members?.
  • Class Constructor: Default constructor, Class initialization, Uniform initialization for objects, Delegate constructor, explicit keyword.
  • Copy Constructor.
  • Class Destructor.
  • Defaulted Constructors, Destructor, and Operators (= default).
  • Class Keywords: this, static, const, mutable, using, friend, delete.

10. Object-Oriented Programming II - Polymorphism and Operator Overloading

  • Polymorphism: C++ mechanisms for polymorphism, virtual methods, Virtual table, override keyword, final keyword, Common errors, Pure virtual method, Abstract class and interface.
  • Inheritance Casting and Run-time Type Identification.
  • 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.
  • C++ Object Layout: Aggregate, Trivial class, Standard-layout class, Plain old data (POD), Hierarchy.

11. Templates and Meta-programming I - Function Templates and Compile-Time Utilities

  • Function Template: Overview, Template instantiation, Template parameters, Template parameter - default value, Overloading, Specialization.
  • Template Variable.
  • Template Parameter Types: Generic type notes, auto placeholder, Function type.
  • Compile-Time Utilities: static_assert, using keyword, decltype keyword.
  • Type Traits: Overview, Type traits library, Type manipulation.

12. Templates and Meta-programming II - Class Templates and SFINAE

  • Class Template: Class specialization, Class template constructor.
  • Constructor template automatic deduction (CTAD).
  • Class Template - Advanced Concepts: Class + Function - specialization, Dependent names - typename and template keywords, Class template hierarchy and using, friend keyword, Template template arguments.
  • Template Meta-Programming.
  • SFINAE: Substitution Failure Is Not An Error: Function SFINAE, Class SFINAE.
  • Variadic Template: Homogeneous variadic parameters, 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.
  • Template Debugging.

13. Translation Units I - Linkage and One Definition Rule

  • Basic Concepts: Translation unit, Local and global scope, Linkage, Visibility.
  • Storage Class and Duration: Storage duration, Storage class, static keyword, Anonymous namespace, extern keyword.
  • Linkage of const and constexpr: Static initialization order fiasco.
  • Linkage Summary.
  • Dealing with Multiple Translation Units: Class in multiple translation units.
  • 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.

14. Translation Units II - Include, Module, and Namespace

  • #include Issues: Include guard, Forward declaration, Circular dependencies, Common linking errors.
  • C++20 Modules: Overview, Terminology, Visibility and reachability, Module unit types, Keywords, Global module fragment, Private module fragment, Header module unit, Module partitions.
  • Compiling Multiple Translation Units: Fundamental compiler flags, Compile methods.
  • Libraries in C++: Static library, Build static libraries, Using static libraries, Dynamic library, Build dynamic libraries, Using dynamic libraries, Application binary interface (ABI), Demangling, Find Dynamic library dependencies, Analyze object/executable symbols.

15. Code Conventions I

  • C++ Project Organization: Project directories, Project files, "Common" project organization notes, Alternative - "Canonical" project organization.
  • Coding Styles and Conventions: Overview, Popular coding styles.
  • Header Files and #include: #include guard, #include syntax, Order of #include, Common header/source filename conventions.
  • Preprocessing: Macro, Preprocessing statements.
  • Variables: static global variables, conversions.
  • Enumerators.
  • Arithmetic Types: Signed vs. unsigned integral types, integral types conversion, Integral types: size and other issues, Floating-point types.
  • Functions: Function parameters, Function arguments, function return values, Function specifiers, lambda expressions.
  • Structs and Classes: struct vs. class, Initialization, Braced initializer lists, Special member functions, =default, =delete, Other issues, Inheritance, Style.

16. Code Conventions II

  • auto.
  • Templates and Type Deduction.
  • Control Flow: Redundant control flow, if/else, Comparison, switch, for/while.
  • Namespace: using namespace directive, Anonymous/unnamed namespace, Namespace and class design, Style.
  • Modern C++ Features: Keywords, Features, Class, Library.
  • Maintainability: Code comprehension, Functions, Template and deduction, Library.
  • Portability.
  • Naming: Entities, Variables, Functions, Style conventions, Enforcing naming styles.
  • Readability and Formatting: Horizontal spacing, Pointers/References, Vertical spacing, Braces, Type decorators, Reduce code verbosity, Other issues.
  • Code Documentation: Function documentation, Comment syntax, File documentation.

17. Debugging and Testing

  • Debugging Overview: Errors, defects, and failures, Cost of software defects, Software defects classification,Program error and classification, Software defect analysis.
  • Assertions: Run-time assertions, Contracts, std::stacktrace.
  • Execution debugging: Breakpoints, Watchpoints / Catchpoints, Control flow, Stack and info, Print, Disassemble, std::breakpoint.
  • Memory Debugging: valgrind.
  • Hardening Techniques: Stack usage, Standard C library hardening, Standard C++ library hardening,Undefined behavior protections, Control flow protections.
  • Sanitizers: Address sanitizer, Leak sanitizer, Memory sanitizers, Undefined behavior sanitizer, Type Sanitizer, Sampling-based sanitizer.
  • Debugging Summary.
  • Compiler Warnings.
  • Static Analysis: Compiler-provided static analyzers, Open-source static analyzers, Proprietary static analyzers.
  • Code Testing: Unit testing, Test-Driven Development (TDD), Code coverage, Fuzz testing.
  • Code Quality: clang-tidy.
  • Code Complexity: Cyclomatic complexity, Cognitive complexity.

18. Ecosystem - Cmake and Other Tools

  • CMake: cmake and ctest
  • Code Documentation: doxygen, Alternatives.
  • Online Tools: AI-Powered code completion/IDE, Compilation and execution, Code transformation, Code benchmarking, Code search engine.
  • Offline Tools: Code formatting, Code statistics, AST diff, Project visualization, Local code search, AST search, Font for coding.

19. Utilities

  • View Introduction and std::span.
  • std::mdspan: std::extends, Layout, std::layout_right, std::layout_left, std::layout_stride, std::layout_right_padded, std::layout_left_padded, Accessor.
  • Strings and std::print: std::string, Conversion from/to numeric values, std::string_view, std::format, std::print.
  • Math Libraries: <cmath> Math Library, <limits> Numerical Limits, <numbers> Mathematical Constants.
  • Random Number: Basic concepts, C++ <random>, Seed, PRNG period and quality, Distribution, Recent algorithms and Performance, Quasi-random, True Random Number Generator (TRNG).
  • Time Measuring: Wall-Clock time, User time, System time
  • Std Class Templates: std::pair, std::tuple, std::variant, std::optional, std::any.
  • Filesystem Library: Query methods, Modify methods.

20. Containers, Iterators, and Algorithms

  • Containers and Iterators: Semantic.
  • Sequence Containers: std::array, std::vector, std::deque, std::list, std::forward_list.
  • Associative Containers: std::set, std::map, std::multiset.
  • Container Adaptors: std::stack, std::queue, std::priority_queue.
  • Implement a Custom Iterator: Implement a simple Iterator.
  • Iterator Notes.
  • Iterator Utility Methods: std::advance, std::next, std::prev, std::distance, Container access methods, Iterator traits.
  • Algorithms Library: std::find_if, std::sort, std::accumulate, std::generate, std::remove_if.
  • C++20 Ranges: Key concepts, Range view, Range adaptor, Range factory, Range algorithms, Range actions.

21. Advanced Topics I

  • Move Semantic: lvalues and rvalues references, Move semantic, std::move, Class declaration semantic.
  • Universal Reference and Perfect Forwarding: Universal reference, Reference collapsing rules, Perfect forwarding.
  • Value Categories.
  • &, && Ref-qualifiers and volatile Overloading.
  • Copy Elision and RVO.
  • Type Deduction: Pass by-reference, Pass by-pointer, Pass by-value, auto deduction, auto(x): Decay-copy.
  • const Correctness.

22. Advanced Topics II

  • Undefined Behavior: Illegal behavior, Platform specific behavior, unspecified behavior, Detecting undefined behavior.
  • Error Handling: Recoverable error handling, Return code, C++ Exceptions, Defining custom exceptions, noexcept keyword, Memory allocation issues, Return code and exception summary, std::expected, Alternative error handling approaches.
  • Smart pointers: std::unique_ptr, std::shared_ptr, std::weak_ptr.
  • Concurrency: Thread methods, Mutex, Atomic, Task-based parallelism.

23. Optimization I - Basic Concepts

  • Introduction: Moore's Law, Moore's Law limitations, Reasons for optimizing.
  • Basic Concepts: Asymptotic complexity, Time-Memory trade-off, Developing cycle, Amdahl's Law, Throughput, Bandwidth, Latency, Performance bounds, Arithmetic intensity.
  • Basic Architecture Concepts: Instruction throughput (IPC), In-Order, and Out-of-Order Execution, Instruction pipelining, Instruction-level parallelism (ILP), Little's law, Data-level parallelism (DLP) and vector instructions (SIMD), Thread-level parallelism (TLP), Single Instruction Multiple Threads (SIMT), RISC, CISC instruction sets.
  • Memory Hierarchy: Memory hierarchy concepts, Memory locality, Core-to-core latency and thread affinity, Memory ordering model.

24. Optimization II - Code Optimization

  • I/O Operations: printf, Memory mapped I/O, Speed up raw data loading.
  • Memory Optimizations: Heap memory, Stack memory, constexpr vs. static constexpr, Cache utilization, Memory alignment, Memory Prefetch.
  • Arithmetic Types: Data types, Arithmetic operations, Conversion, Floating-point, Compiler intrinsic functions, Value in a range, Lookup table.
  • Control Flow: Branches, Branch Hints - [[likely]] / [[unlikely]], Signed/Unsigned integers, Loops, Loop hoisting, Loop unrolling, Assertions, Compiler hints [[assume]]/std::unreachable(), Recursion.
  • Functions: Function call cost, Argument passing, Function inlining, Pure functions, Constant functions, Pointer aliasing.
  • Object-Oriented Programming.
  • Standard Library and Other Language Aspects.

25. Optimization III - Non-Coding Optimizations and Benchmarking

  • Compiler Optimizations: About the compiler, Compiler optimization flags, Floating-point optimization flags, Linker optimization flags, Architecture flags, Help the compiler to produce better code, Profile-guided optimization (PGO and AutoFDO), Post-processing binary optimizer, Polyhedral optimizations.
  • Compiler Transformation Techniques: Basic transformations, Loop unswitching, Loop fusion, Loop fission, Loop interchange, Loop tiling.
  • Libraries and Data Structures.
  • Performance Benchmarking: What to test?, Workload/Dataset quality, Metric evaluation.
  • Stable Performance Measurement: Cache behavior, Stable CPU performance, Multi-thread considerations, Operating system considerations, Program memory layout, Measurement overhead, Compiler optimizations.
  • Profiling: gprof, uftrace, callgrind, cachegrind, perf Linux profiler.
  • Parallel Computing: Concurrency vs. parallelism, Performance scaling, Gustafson's Law, Parallel programming languages.

26. Software Design I - Basic Concepts (DRAFT)

  • Books and References.
  • Basic Concepts: Abstraction, interface, and module, Class Invariant.
  • Software Design Principles: Separation of concern, Low coupling, high cohesion, Encapsulation and information hiding, Design by contract, Problem decomposition, Code reuse.
  • Software Complexity: Software entropy, Technical debt.
  • The SOLID Design Principles.
  • Class Design: The class interface principle, Member functions vs. free functions, namespace functions vs. class static methods.
  • BLAS GEMM Case Study.
  • Owning Objects and Views.
  • Value vs. Reference Semantics.
  • Global Variables.

27. Software Design II - Design Patterns and Idioms (DRAFT)

  • C++ Idioms: Rule of Zero, Rule of Three, Rule of Five.
  • Design Pattern: Singleton, Pointer to IMPLementation (PIMPL), Curiously Recurring Template Pattern (CRTP), Template virtual functions.

28. Binary Size

  • Binary Size Introduction:
  • Compiler and Linker Techniques: Optimization flags, Debugging and runtime information flags, Symbol visibility, Exceptions flags, Linker flags, Link-Time Optimization (LTO), CMake support.
  • Coding Aspects: Function Inlining, Function Visibility, Templates, Static Storage Duration, Linkage, Polymorphic classes, Exceptions, Header Inclusion.
  • Binary Size Tools: nm and objdump, Bloaty, Executable packer.

29. Build Time

  • Compile Time Introduction: The importance of build time, Causes of long build time.
  • Compiler Aspects: Compiler flags, Optimized compiler builds.
  • C++ Standard Version.
  • Precompiled Header (PCH).
  • Linker Aspects: Link-Time Optimization (LTO), Thin Link-Time Optimization (ThinLTO), Main linkers, Linker flags.
  • Unity Build.
  • Tools for Reducing Build Time: ninja, Compiler cache, Distributed compilation, RAM disk, Include-What-You-Use (IWYU).
  • Function Inlining.
  • Template: Template metaprogramming cost, extern template, constexpr variable vs. template structure + static Data member, Tag dispatching, Fold expressions, C++20 concepts, auto, using type aliasing.
  • Other Aspects: C++20 modules, Overload resolution, other code aspects, Pointer Implementation (PIMPL), Include guard vs. #pragma once, Static vs. dynamic linking, Comments and formatting, External factors.
  • Tools to Analyze Build Time: Clang build-time analysis, ninjatracing, Templight, Build Bench, Visual Studio - CompileScore, Visual Studio - C++ Build Insights.

Reporting Bugs 🐛 and Contributing

Please see the CONTRIBUTING.md file for more information.

Where the Course has been used

The Modern C++ Programming course was created in 2018 and adopted by the University of Verona, Italy. It is taught as part of the Bachelor's and Master's degree programmes in Computer Science, for three and two years respectively. The course has also been used to train interns at NVIDIA.

Have you adopted the course, or are you interested in using it in certain contexts? If so, please get in touch so that I can keep track of usage. I'm also willing to share the LaTeX source code (the Tyst version will be open-sourced on GitHub soon).

License

This repository is dual-licensed:

Author

Federico Busato, federico-busato.github.io