1_translation
Understanding the translation stages are critical for debugging compilation errors, optimizing bu…
1_translation
Understanding the translation stages are critical for debugging compilation errors, optimizing bu…
2_modules
C++ Programming C++23 notes covering key definitions, core concepts, worked examples, and practic…
1_data_layout
In managed languages (Java, C#), types are abstract constraints enforced by a virtual machine. In…
2_pointers_references_views
In high-level languages (Java, Python), references are opaque handles. In C++, pointers are direc…
3_initialization_and_lifetime
C++ Programming Storage Duration notes covering key definitions, core concepts, worked examples, …
Flashcards Type System
20 interactive flashcards. Press Space to flip, rate 1-4 to schedule next review.
Practice Types Resources
12 practice problems covering fundamental C++ concepts: types, RAII, ownership, move semantics, s…
1_ownership_and_raii
RAII (Resource Acquisition Is Initialization) is the foundational C++ idiom that binds resource L…
2_value_categories_and_move
Every C++ expression has a — a property that determines which operations are Legal on it and how …
0_intro
Part 4 addresses the central problem in systems programming:
1_class_design
Understanding how the compiler lays out objects in memory is fundamental to writing correct and E…
2_runtime_polymorphism
Virtual functions are the foundation of runtime polymorphism in C++. When a member function is De…
Flashcards Oop
PROGRAMMING 6_object_oriented flashcards: C++ Flashcards: Object-Oriented Programming. Comprehens…
1_containers_and_allocators
The C++ standard library provides three primary sequence containers: And . Each uses a different …
2_algorithms_and_ranges
C++20 fundamentally restructured the standard library around , introducing the Iterator-sentinel …
3_input_output_formatting
The C++ I/O system is built on a layered architecture. High-level stream classes ( ) perform form…
4_system_utilities
(C++17) provides a portable interface for manipulating paths, querying file Metadata, iterating d…
1_threading_and_synchronization
This section covers thread creation with and Hardware concurrency Detection, join/detach semantic…
2_memory_model_and_atomics
This section covers the as-if rule and compiler reordering, CPU-level store buffers and load Buff…
3_coroutines_and_async_io
This section covers coroutines as suspendable functions, the stackless vs stackful design trade-o…
Forgetting rule of zero/three/five: If your class manages a resource, define or delete the copy constructor, copy assignment, move constructor, and move assignment. If it does not, the compiler-generated defaults may silently cause double-free bugs or shallow copies of owned resources.
Using raw new/delete instead of RAII: Manual memory management with new and delete is error-prone — exceptions, early returns, and forgotten cleanup cause leaks and dangling pointers. Use smart pointers and stack allocation to bind resource lifetime to scope.
Assuming std::move moves data: std::move casts an lvalue to an rvalue reference — it does not itself move anything. The actual move happens in the move constructor or move assignment operator. Misusing std::move on objects after they have been moved-from leads to undefined or surprising behaviour.
C++ systems programming is fundamentally about owning and managing resources. Unlike garbage-collected languages where the runtime cleans up after you, C++ puts you in control of memory, file handles, network connections, and other resources. The key insight is that resource lifetimes can be tied to object lifetimes through RAII — when an object is constructed, it acquires a resource; when it is destroyed, it releases it. This simple idea eliminates entire classes of bugs like memory leaks and dangling pointers.
The type system, ownership model, and compilation model all serve this central goal. Understanding how code goes from source text to machine code (the compilation model), how data is laid out in memory (types and references), and how to transfer ownership safely (resource management) gives you the mental model needed to write C++ that is both efficient and correct. The standard library builds on these foundations with containers, algorithms, and utilities that follow the same principles.
When approaching these notes, think of each section as a layer of the same onion: the compilation model tells you what happens to your code, the type system tells you how data is represented, resource management tells you who is responsible for that data, and the standard library gives you battle-tested tools built on top of it all.