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

Overview

Modern C++ Programming

C++11 / C++14 / C++17 / (C++20)

TOPICS

1. Introduction

  • A Little History of C/C++ Programming Languages
  • Areas of Application and Popularity
  • C++ Philosophy
  • Books and References
  • The Course

2. Basic Concepts I - Fundamental Types

  • Preparation: What compiler should I use?, What editor/IDE compiler should I use?, How to compile?
  • Hello World: I/O Stream
  • C++ Fundamental Types Overview: Arithmetic Types, Other Arithmetic Types, Pointer Type
  • Conversion Rules
  • Math Operators
  • Integral Data Types: Fixed Width Integers, When Use Signed/Unsigned Integer?, Promotion, Truncation, Undefined Behavior
  • Floating-point Types and Arithmetic: Normal/Denormal Values, Summary, Not a Number (NaN), Infinity, Properties
  • Floating-point Issues: Floating-point Comparison, Catastrophic Cancellation

3. Basic Concepts II - Entities and Control Flow

  • Enumerators
  • struct, union, and Bitfield
  • using, decltype, and auto
  • Control Flow: if Statement, for Loop, switch, goto

4. Basic Concepts III - Memory Management

  • Heap and Stack: Stack Memory, new, delete, Memory Leak
  • Initialization: Uniform Initialization
  • Pointers and References: Pointer, Address-of operator &, Reference
  • const, constexpr, consteval, constinit
  • Explicit Type Conversion: static_cast, const_cast, reinterpret_cast, Type Punning
  • sizeof Operator

5. Basic Concepts IV - Functions and Preprocessing

  • Declaration and Definition
  • Functions: Pass by-Value, Pass by-Pointer, Pass by-Reference, Overloading, Default Parameters, Attributes
  • Function Objects and Lambda Expressions: Function Pointer, Function Object (or Functor), Capture List, Other Features, Capture List and Classes
  • Preprocessing: Preprocessors, Common Errors, Useful Macro, Stringizing Operator (#), #pragma and #error, Token-Pasting Operator (##), Variadic Macro

6. C++ Object Oriented Programming I

  • C++ Classes
  • Class Hierarchy: Access specifiers, Inheritance Access Specifiers
  • Class Constructor: Default Constructor, Initializer List, Uniform Initialization, Delegate Constructor, explicit Keyword
  • Copy Constructor
  • Class Destructor
  • Defaulted Members: Defaulted Constructor
  • Class Keywords: this, static, const, mutable, using, friend, delete

7. C++ Object Oriented Programming II

  • 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, Subscript Operator, Comparison Operator, Function Call Operator, Conversion Operator, Increment and Decrement Operators, Assignment Operator, Stream Operator, Operator Notes
  • C++ Special Objects: Aggregate, Trivial Class, Standard-Layout Class, Plain Old Data (POD), Hierarchy

8. C++ Templates and Meta-programming I

  • Function Templates: Overview, Template Parameters, Template Parameter - Default Value, Specialization, Overloading, auto Deduction
  • Compile-Time Utilities: static_assert, decltype Keyword, using Keyword
  • Type Traits: Overview, Type Traits Library, Type Manipulation, Type Relation and Transformation
  • Template Parameters: Overview, Special Cases

9. C++ Templates and Meta-programming II

  • Class Template: Class Specialization, Class + Function - Specialization, friend Keyword, Dependent Names, Template Variable
  • Template Meta-Programming
  • SFINAE: Substitution Failure Is Not An Error: Function SFINAE, Class SFINAE, Class + Function SFINAE
  • Variadic Template: Folding Expression, Variadic Class Template

10. Translation Units

  • Basic Concepts: Translation Unit, Local and Global Scopes
  • Linkage: static and extern Keywords, Internal/External Linkage Example, Linkage of const and constexpr, Linkage of inline Functions/Variables
  • Variables Storage: Storage Class, Storage Duration
  • Dealing with Multiple Translation Units: One Definition Rule (ODR), Class in Multiple Translation Units, Global Constant
  • Function Template
  • Class Template
  • Undefined Behavior and Summary
  • #include Issues: Forward Declaration, Include Guard, Circular Dependencies, Common Linking Errors
  • Namespace: Namespace Functions vs. static Methods, Namespace Alias, Anonymous Namespace, inline Namespace
  • How to Compile: Compile Strategies, Compile with Libraries, Build Static/Dynamic Libraries, Find Dynamic Library Dependencies, Analyze Object/Executable Symbols

11. Code Conventions

  • C++ Project Organization: Project Directories, Project Files, src/include directories
  • Coding Styles and Conventions
  • #include
  • Macro and Preprocessing
  • Namespace
  • Variables
  • Functions
  • Structs and Classes
  • Modern C++ Features
  • Maintainability
  • Naming and Formatting
  • Code Documentation

12. Ecosystem

  • Debugging: Assertion, Execution Debugging (gdb)
  • Memory Debugging: valgrind
  • Sanitizers: Address Sanitizer, Leak Sanitizer, Memory Sanitizers, Undefined Behavior Sanitizer
  • Debugging Summary
  • Code Checking and Analysis: Compiler Warnings, Static Analyzers
  • Code Testing: Unit Test, Code Coverage, Fuzz Testing
  • Code Quality: clang-tidy
  • CMake
  • 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 - TabNine/Kite, Local Code Search - ripgrep, Code Search Engine - searchcode/grep.app, Code Exploration - SourceTrail, Code Benchmarking - Quick-Bench, Font for Coding

13. Utilities

  • I/O Stream: Manipulator, ofstream/ifstream
  • Math Libraries
  • Strings: std::string, Conversion from/to Numeric Values, std::string view, std::format
  • Algorithm Library
  • Random Number: Basic Concepts, C++ , Seed, PRNG Period and Quality, Distribution Quasi-random
  • Time Measuring: Wall-Clock Time, User Time, System Time
  • Std Template Classes: std::pair, std::tuple, std::variant, std::optional, std::any
  • Filesystem Library: Query Methods, Modify Methods

14. Containers, Iterators, and Algorithms

  • Containers and Iterators
  • Sequence Containers: std::array, std::vector, std::list, std::deque, std::forward_list
  • Associative Containers: std::set, std::map
  • Container Adaptors: std::stack, std::queue, std::priority_queue
  • Implement a Custom Iterator: Semantic, Implement a Simple Iterator
  • Iterator Utility Methods: std::advance, std::next, std::prev, std::distance, Range Access Methods, Iterator Traits
  • Algorithms Library: std::find_if, std::sort, std::accumulate, std::generate, std::remove_if

15. Advanced Topics

  • Move Semantic: lvalues and rvalues references, Move Semantic, Compiler Implicitly Declared, std::move
  • Universal Reference and Perfect Forwarding: Universal Reference, Reference Collapsing Rules, Perfect Forwarding
  • Value Categories
  • Copy Elision and RVO
  • Type Deduction: Pass-by-Reference, Pass-by-Pointer, Pass-by-Value
  • const Correctness
  • 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

16. Optimization I

  • General Concepts: Asymptotic Complexity, Optimization Cycle, Ahmdal Law, Performance Bounds, Arithmetic Intensity, Instruction-Level Parallelism, Little’s Law, Time-Memory Trade-off, Roofline Model
  • I/O Operations: printf, Memory Mapped I/O, Speed Up Raw Data Loading
  • Locality and Memory Access Patterns: Memory Hierarchy, Memory Locality, Internal Structure Alignment, External Structure Alignment
  • Arithmetic: Data Types, Operations, Conversion, Floating-Point, Compiler Intrinsic Functions, Value in a Range, Lookup Table
  • Control Flow: Loop Hoisting, Loop Unrolling, Branch Hints, Recursion
  • Functions: Function Call Cost, Argument Passing, Function Optimizations, Inlining Constrains, Pointers Aliasing
  • C++ Objects: C++ Objects Optimizations

17. Optimization II

  • Compiler Optimizations: About the Compiler, Architecture Flags, Optimization Flags, Help the Compiler to Produce Better Code, Profile Guided Optimization (PGO)
  • Compiler Transformation Techniques
  • Libraries and Data Structures: External Libraries, Std Library
  • Profiling: gprof, uftrace, callgrind, cachegrind, perf Linux profiler
  • Performance Benchmarking: What to Test?, Workload/Dataset Quality, Cache Behavior, Stable CPU Performance, Program Memory Layout
  • Parallel Computing: Concurrency vs. Parallelism, Performance Scaling, Gustafson’s Law, Parallel Programming Languages

Essential Tool

Online compiler and execution: CompilerExplorer

  • for code execution: [Add new..] -> [execution only]

Reporting bugs and contributing

If you find any typos, conceptual errors, or sections to improve, please report them by writing directly to me or by using the issue panel

Author

Federico Busato

You might also like...
Practical exercises for the "Advanced C++" course in 2021/22

Advanced C++ Programming - Practical Part This repository contains practical exercises to accompany the lecture. Based on Material by Alex Hirsch. Gra

Community-gathered tests for C++ course read in YSDA
Community-gathered tests for C++ course read in YSDA

YSDA-CPP-collective-tests Коллективно собранные тесты для задач с закрытыми тестами из курса C++. Структура Структура этого репозитория соответствует

Programming-Basics - This Repository Contains source codes of various programming languages. Please Contribute to make this Useful.
Programming-Basics - This Repository Contains source codes of various programming languages. Please Contribute to make this Useful.

Programming-Basics About ❓ Want To Start your Open-Source Journey Without Facing Difficulties?,If Yes, Then You Are at The Right Place! 🎯 Don't Know

Homework repo of Modern Cpp for CV (2020Spring) at UniBonn

Modern C++ Course For CV (2020) source file can be found here. Homework Assignments Homework # Title Homework sheet Files and Data MyStatus Homework_1

🐛 Pangea Software's Bugdom for modern systems
🐛 Pangea Software's Bugdom for modern systems

Bugdom This is Bugdom running on modern macOS, Windows and Linux! This version, at https://github.com/jorio/Bugdom, is approved by Pangea Software. Ge

📚 Modern C++ Tutorial: C++11/14/17/20 On the Fly
📚 Modern C++ Tutorial: C++11/14/17/20 On the Fly

The book claims to be "On the Fly". Its intent is to provide a comprehensive introduction to the relevant features regarding modern C++ (before 2020s). Readers can choose interesting content according to the following table of content to learn and quickly familiarize the new features you would like to learn. Readers should be aware that not all of these features are required. Instead, it should be learned when you really need it.

A cheatsheet of modern C++ language and library features.

C++20/17/14/11 Overview Many of these descriptions and examples come from various resources (see Acknowledgements section), summarized in my own words

Pangea Software's Mighty Mike (Power Pete) for modern systems
Pangea Software's Mighty Mike (Power Pete) for modern systems

Mighty Mike (a.k.a. Power Pete) This is Pangea Software's Mighty Mike updated to run on modern systems. Set in a toy store, this top-down action game

Feature-rich C99 library for memory scanning purposes, designed for Windows running machines, meant to work on both 32-bit and 64-bit portable executables. Has a modern C++ wrapper.

memscan Feature-rich C99 library for memory scanning purposes, designed for Windows running machines, meant to work on both 32-bit and 64-bit portable

Comments
Releases(v1.2.0)
  • v1.2.0(Oct 23, 2022)

    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
    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Jun 24, 2022)

    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

    Source code(tar.gz)
    Source code(zip)
  • v1.0.2(May 22, 2022)

  • v1.0.1(Apr 23, 2022)

    Translation Units (sections 1-8):

    • Refactored description flow
    • Many improvements and clarifications
    • Several typos fixed
    • const/constexpr does not imply static
    • template variables have external linkage even if specialized
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Apr 14, 2022)

Owner
Federico
Accelerating Sparse Computation @NVIDIA. Principal Software Engineer of CUDA cuSPARSE. Researcher in my spare time
Federico
A simple messenger written in C for Principal of Programming course final project

Mohsenger A simple messenger written in C for Principal of Programming course final project Implemented by socket and sqlite3 dbms and single thread c

Mohsen Pakzad 6 Sep 25, 2021
Programs and my Notes from the course: "Beginning c++ Programming - From Beginner to Beyond" by Dr. Frank J. Mitropoulos

Project Info Technology Stack Linux (Arch) Visual Studio Code GCC 11.1.0 (since GCC 11.1 the default target is gnu++17, a superset of C++17) Source Ud

Alok Shandilya 1 Oct 22, 2021
Series of C algorithms written (by myself) during the C programming course

C Algorithms (Work in Progress...) Basic function Bolletta Tabella caratteri di escape Selection (if) Broker Calcolatrice Verifica della validità di u

Michele Martino 8 Mar 9, 2022
A project for Computer Programming (2) Course // C language

Fun-programming-project A project for Course : Computer Programming (2) “ CS181 ” presented to Dr. Abeer Alhujaylan Team work : Feda mousa leen mohamm

Feda Mousa 2 Feb 4, 2022
A comprehensive catalog of modern and classic books on C++ programming language

A comprehensive catalog of modern and classic books on C++ programming language

Yurii Cherkasov 384 Dec 28, 2022
A modern dynamically typed programming language that gets compiled to bytecode and is run in a virtual machine called SVM (Strawbry Virtual Machine).

Strawbry A bytecode programming language. Here is what I want Strawbry to look like: var a = 1 var b = 2 var c = a + b print(c) func sqrt(x) { re

PlebusSupremus1234 6 Jan 5, 2022
Linux Network Programming in Modern C++

Linux Network Programming in Modern C++ Starter code for network programming in the Linux environment, providing wrapper classes written in modern C++

Francis Y. Yan 13 Feb 7, 2022
Problem Solving Ability Skills Course

It is complete course on Competitive Programming & discussed optimal solution for each problem in live session. In this course, I am also taking your

Aniruddha M Agrawal 24 Apr 25, 2022
University of Bergamo - C++ Dev Course (Computer Engineering) 2021/2022

University of Bergamo - 21012 Dev Course C++ 2021/2022 This git repository contains the source code in C++ language to support the lessons of the C++

Mauro Pelucchi 11 Dec 1, 2022
It contains the codes of the algorithm 101 course carried out at Galatasaray University.

IEEE-GSU-ALGO-101 It contains the codes of the algorithm 101 course carried out at Galatasaray University. Il contient les codes du cours algorithme 1

null 6 Jul 8, 2022