Latest Changes

The following noteworthy changes have been made:

2024 Oct 22Revision
2024 Oct 22Revision
5.4 -- The as-if rule and compile-time optimizationMoved and rewrote content from the following lesson
2024 Oct 19Revision
16.3 -- std::vector and the unsigned length and subscript problemAdded a neat workaround to index std::vector with signed indices
2024 Oct 11Revision
12.2 -- Value categories (lvalues and rvalues)Added method to determine whether expression is lvalue or rvalue
2024 Oct 11Revision
12.4 -- Lvalue references to constAdded warning and example exhibiting behavior to avoid
2024 Oct 11Revision
12.3 -- Lvalue referencesClarified what applies to non-const lvalue references, all lvalue references, and all references
2024 Oct 6Revision
9.5 -- std::cin and handling invalid inputRefactored section: Checking for EOF
2024 Oct 4Revision
14.13 -- Temporary class objectsAdded section: static_cast vs explicit instantiation of a temporary object
2024 Sep 30Revision
14.17 -- Constexpr aggregates and classesAdded more examples and discussion around const/constexpr objects and functions
2024 Sep 29Revision
14.10 -- Constructor member initializer listsAdded two sections discussing when constructors fail
2024 Sep 29Revision
12.8 -- Null pointersAdded a joke to the lesson
2024 Sep 29Revision
5.1 -- Constant variables (named constants)Added a joke to the optional reading section at the bottom of the lesson
2024 Sep 26Revision
8.5 -- Switch statement basicsAdded section: Switch vs if-else
2024 Sep 23Revision
11.8 -- Function templates with multiple template typesRevised section: Function templates with multiple template type parameters
2024 Sep 23Revision
10.9 -- Type deduction for functionsSeparated benefits and downsides and added more of them
2024 Sep 23Revision
10.5 -- Arithmetic conversionsAdded section: std::common_type and std::common_type_t
2024 Sep 20Revision
10.8 -- Type deduction for objects using the auto keywordClarified some type deduction cases with const and constexpr
2024 Sep 20Revision
5.1 -- Constant variables (named constants)Clarified that const is part of the type of an object
2024 Sep 17Revision
5.1 -- Constant variables (named constants)Added section: Why variables should be made constant
2024 Sep 13Revision
1.4 -- Variable assignment and initializationVarious wording and formatting changes throughout. Added links to other initialization forms
2024 Sep 13Revision
5.8 -- Inline functions and variablesAdded optional reading about connection between historic and modern use of inline
2024 Sep 12Revision
27.4 -- Uncaught exceptions and catch-all handlersRevised section: Debugging unhandled exceptions
2024 Aug 26Revision
14.3 -- Member functionsRevised section: Member variables and functions can be defined in any order
2024 Aug 20Revision
11.7 -- Function template instantiationAdded section: Function templates and default arguments for non-template parameters
2024 Aug 19Revision
4.12 -- Introduction to type conversion and static_castAdded more information about the result of sign conversions using static_cast
2024 Aug 13Revision
13.8 -- Struct aggregate initializationAdded section: Overloading operator<< to print a struct
2024 Aug 12Revision
2.5 -- Introduction to local scopeAdded section: When to use function parameters vs Local variables
2024 Aug 6Revision
14.14 -- Introduction to the copy constructorSeparated pass by value and return by value cases
2024 Aug 6Revision
2.5 -- Introduction to local scopeClarified that return by value creates a temporary object
2024 Aug 6Revision
15.5 -- Class templates with member functionsAdded section: Injected class names
2024 Jul 21Revision
16.8 -- Range-based for loops (for-each)Strengthened recommendation to use const auto& over auto
2024 Jul 21Revision
O.2 -- Bitwise operatorsAdded section: Bitwise operators perform integral promotion on smaller integral types
2024 Jul 20Revision
25.5 -- Early binding and late bindingAdded additional examples and some clarification of terms
2024 Jul 14Revision
5.12 -- std::string_view (part 2)Added advanced information on std::string& and std::string_view to the quick guide
2024 Jul 10Revision
1.5 -- Introduction to iostream: cout, cin, and endlAdded sections: std::cin is buffered, and the basic extraction process
2024 Jul 4Revision
5.9 -- Constexpr and consteval functionsRestructured some of lesson
2024 Jul 2Revision
2024 Jun 28Revision
2024 Jun 17Revision
21.4 -- Overloading the I/O operatorsAdded section: Guarding against partial extraction
2024 Jun 7Revision
24.7 -- Calling inherited functions and overriding behaviorAdded section: Overload resolution in derived classes
2024 May 29Revision
11.7 -- Function template instantiationAdded section: Beware function templates with modifiable static local variables
2024 May 28Revision
17.1 -- Introduction to std::arrayAdded warning about zero-length std::array
2024 May 26Revision
17.7 -- Introduction to C-style arraysAdded section: C-style arrays dont support assignment
2024 May 24Revision
17.9 -- Pointer arithmetic and subscriptingAdded warning about pointer arithmetic only being defined within arrays
2024 May 22New
14.17 -- Constexpr aggregates and classesNew lesson: Constexpr aggregates and classes
2024 May 17Revision
11.8 -- Function templates with multiple template typesAdded section: Function templates may be overloaded
2024 May 16Revision
9.5 -- std::cin and handling invalid inputRefactored some input handling code into reusable functions
2024 Apr 16Revision
13.10 -- Passing and returning structsAdded section: Passing temporary structs
2024 Apr 14Revision
13.3 -- Unscoped enumerator integral conversionsAdded section: Value-initializing an enumeration
2024 Apr 8Revision
12.6 -- Pass by const lvalue referenceAdded section: Passing rvalues of a different type to a const lvalue reference parameter
2024 Apr 8Revision
12.4 -- Lvalue references to constAdded section: Initializing an lvalue reference to const with a value of a different type
2024 Apr 2Revision
11.5 -- Default argumentsAdded section: Default arguments don’t work for functions called through function pointers
2024 Mar 29Revision
26.6 -- Partial template specialization for pointersRewrote lesson to simplify and remove manual memory management stuff
2024 Mar 21Revision
2024 Mar 19New
12.15 -- std::optionalNew lesson: std::optional
2024 Mar 8Revision
8.13 -- Introduction to random number generationRewrote sections on Seeding and Underseeding
2024 Mar 5Revision
8.5 -- Switch statement basicsAdded section: Labels are conventionally not indented
2024 Mar 5Revision
2.9 -- Naming collisions and an introduction to namespacesAdded sections: Scope regions & Curly braces and indented code
2024 Mar 4Revision
26.4 -- Class template specializationAdded section: Where to define class template specializations
2024 Mar 4Revision
5.9 -- Constexpr and consteval functionsClarifications on constexpr functions calling constexpr functions, and corrections on std::is_constant_evaluated()
2024 Mar 2Revision
15.6 -- Static member variablesAdded section: Only static members may use type deduction (`auto` and CTAD)
2024 Feb 29Revision
13.11 -- Struct miscellanyAdded section: Structs that are owners should have data members that are owners
2024 Feb 16Revision
16.5 -- Returning std::vector, and an introduction to move semanticsAdded section on why we pass move-capable types by reference and return them by value
2024 Feb 16Revision
8.7 -- Goto statementsAdded xkcd comic and note about indentation of statement labels
2024 Feb 15Revision
1.6 -- Uninitialized variables and undefined behaviorClarified nomenclature issue when default-initialization results in uninitialized variable
2024 Feb 15Revision
1.4 -- Variable assignment and initializationCorrected definition of initializer (vs initial value)
2024 Feb 15Revision
0.12 -- Configuring your compiler: Choosing a language standardAdded notes about experimental/preview build support
2024 Feb 2Revision
2024 Jan 28Revision
13.11 -- Struct miscellanyAdded tip about minimizing padding
2024 Jan 26Revision
5.9 -- Constexpr and consteval functionsAdded section: Constexpr/consteval functions can use non-const local variables
2024 Jan 25Revision
0.11 -- Configuring your compiler: Warning and error levelsRevised when errors and warnings are emitted
2024 Jan 25New
B.5 -- Introduction to C++23Added introduction to C++23 listing major features
2024 Jan 17Revision
0.12 -- Configuring your compiler: Choosing a language standardAdded support for Visual Studio in language standard reporting code
2024 Jan 13Revision
0.12 -- Configuring your compiler: Choosing a language standardAdded section: What language standard is my compiler currently using?
2024 Jan 13Revision
5.5 -- Constant expressionsAdded section: Optimization can make programs harder to debug
2024 Jan 13Split
2.5 -- Introduction to local scopeMoved introduction to temporary objects to this lesson
2024 Jan 10Split
2024 Jan 2Revision
9.5 -- std::cin and handling invalid inputDiscuss when extraction succeeds but extraneous input should be treated as failure case
2024 Jan 2Revision
5.9 -- Constexpr and consteval functionsAdded section: Why not constexpr every eligible function?
2023 Dec 31Revision
5.5 -- Constant expressionsRevised lesson for improved accuracy and comprehension
2023 Dec 28Split
8.15 -- Global random numbers (Random.h)Split random.h out of the prior lesson to make it easier to find
2023 Dec 28Split
SiteMoved function overloading and function templates from chapter 10 to chapter 11
2023 Dec 28Split
SiteMoved error detection and handling topics from chapter 8 to chapter 9
2023 Dec 15Revision
26.4 -- Class template specializationAdded revised content from prior lesson
2023 Dec 15Revision
26.3 -- Function template specializationRevised lesson, moved some content to next lesson
2023 Nov 27Revision
5.7 -- The conditional operatorUndated section: The type of the expressions must match or be convertible
2023 Nov 26Revision
21.9 -- Overloading the subscript operatorAdded section: Removing duplicate code between const and non-const overloads
2023 Nov 24Revision
0.12 -- Configuring your compiler: Choosing a language standardAdded section: Compilers often have incomplete support for new language features
2023 Nov 20Revision
2023 Nov 20Revision
14.8 -- The benefits of data hiding (encapsulation)Added examples to section Prefer non-member functions to member functions
2023 Nov 20Revision
21.11 -- Overloading typecastsAdded section: Explicit typecasts
2023 Nov 11Revision
12.12 -- Return by reference and return by addressAdded a less obvious example where lifetime extension doesn't work
2023 Nov 11Revision
5.10 -- Introduction to std::stringAdded advanced section describing what "s" suffix expands to
2023 Nov 11Revision
5.2 -- LiteralsMade clear that "s" and "sv" suffixes create temporary objects
2023 Nov 6Revision
11.6 -- Function templatesAdded section: Naming template parameters
2023 Oct 30Revision
5.5 -- Constant expressionsMoved as-if rule discussion up, additional examples
2023 Oct 24Split
SiteChapter 5 refactored from chapter 4 and a few other lessons
2023 Oct 18Revision
11.4 -- Deleting functionsAdded section: Deleting all non-matching overloads
2023 Oct 10New
2023 Oct 5Revision
13.8 -- Struct aggregate initializationAdded section: Initializing a struct with another struct of the same type
2023 Oct 5Split
15.10 -- Ref qualifiersRefactored lesson content from prior lesson
2023 Oct 5Split
14.7 -- Member functions returning references to data membersRefactored lesson content from prior lesson
2023 Oct 4Revision
14.3 -- Member functionsAdded section: Member functions can be overloaded
2023 Sep 27Revision
13.15 -- Alias templatesSplit alias templates out from prior lesson
2023 Sep 26Revision
14.8 -- The benefits of data hiding (encapsulation)Added section: Prefer non-member functions to member functions
2023 Sep 25Revision
12.12 -- Return by reference and return by addressAdded section: It’s okay to return by const reference an rvalue passed by const reference
2023 Sep 25Revision
14.9 -- Introduction to constructorsAdded section: Constructors should not be const
2023 Sep 25Moved
14.4 -- Const class objects and const member functionsMoved lesson up one chapter (from 15.2)
2023 Sep 22Revision
1.10 -- Introduction to expressionsAdded section: Subexpressions, full expressions, and compound expressions
2023 Sep 22Revision
5.8 -- Inline functions and variablesUpdates for accuracy, added mention of header-only libraries
2023 Sep 15Revision
5.9 -- Constexpr and consteval functionsAdded section: Can a constexpr function call a non-constexpr function?
2023 Sep 13Revision
5.12 -- std::string_view (part 2)Added section: std::string_view may or may not be null-terminated
2023 Sep 12Revision
5.10 -- Introduction to std::stringAdded section: Returning a std::string
2023 Sep 11New
SiteChapters 14, 15, 16, and 17 updated
2023 Sep 4Revision
6.4 -- Increment/decrement operators, and side effectsAdded section: When to use prefix vs postfix
2023 Aug 31Revision
13.14 -- Class template argument deduction (CTAD) and deduction guidesAdded section: CTAD doesn't work with non-static member initialization
2023 Aug 26Revision
12.4 -- Lvalue references to constAdded section: Constexpr lvalue references
2023 Aug 23Revision
O.1 -- Bit flags and bit manipulation via std::bitsetAdded section: Querying a std::bitset
2023 Aug 17Revision
13.14 -- Class template argument deduction (CTAD) and deduction guidesAdded section: Type aliases and alias templates for class templates
2023 Jul 31New
12.13 -- In and out parametersNew lesson: In and out parameters
2023 Jul 26Split
12.6 -- Pass by const lvalue referenceRefactored lesson content from prior lesson
2023 Jul 21Split
13.11 -- Struct miscellanyRefactored lesson content from prior lesson
2023 Jul 18Revision
14.6 -- Access functionsAdded section: The order of class member declaration
2023 Jul 18Revision
27.5 -- Exceptions, classes, and inheritanceAdded section: Exception classes should be copyable
2023 Jul 13Revision
5.9 -- Constexpr and consteval functionsAdded section: Constexpr/consteval function parameters are not constexpr, but can be used as arguments to other constexpr functions
2023 Jul 13Revision
5.5 -- Constant expressionsAdded section: Const and constexpr function parameters
2023 Jun 29Revision
2023 Jun 28Revision
7.6 -- Internal linkageAdded some best practices
2023 Jun 28Revision
5.12 -- std::string_view (part 2)Rewrote lesson and moved up from chapter 11
2023 Jun 28Revision
5.11 -- Introduction to std::string_viewRefactored lesson to simplify a bit
2023 Jun 24Revision
2.11 -- Header filesAdded section: How including definitions in a header file results in a violation of the one-definition rule
2023 Jun 24Revision
7.4 -- Introduction to global variablesAdded info on global variables declared inside namespaces
2023 Jun 20Revision
5.11 -- Introduction to std::string_viewAdded section: "Assignment changes what the std::string_view is viewing". Added examples to other sections.
2023 Jun 20Revision
5.2 -- LiteralsAdded section: C-style string literals
2023 Jun 19Revision
8.14 -- Generating random numbers using Mersenne TwisterUpdated Random.h to handle non-int types
2023 Jun 13Revision
5.11 -- Introduction to std::string_viewAdded section: A quick guide on when to use `std::string` vs `std::string_view`
2023 Jun 5Revision
2.4 -- Introduction to function parameters and argumentsAdded section: Function parameters not used in the function body
2023 May 30New
8.4 -- Constexpr if statementsAdded lesson: Constexpr if statements
2023 May 29Revision
6.1 -- Operator precedence and associativityRewrote lesson to clarify concepts and tighten terminology
2023 May 11Revision
16.6 -- Arrays and loopsAdded quiz 4. Thanks to reader Waldo!
2023 May 11Revision
8.10 -- For statementsAdded quizzes 4 and 5. Thanks to reader Waldo!
2023 May 9Revision
0.11 -- Configuring your compiler: Warning and error levelsRecommending -Wconversion for GCC/Clang/VS Code users
2023 May 9Revision
9.4 -- Detecting and handling errorsAdded section: When to use `std::cout` vs `std::cerr` vs logging
2023 May 5Revision
0.11 -- Configuring your compiler: Warning and error levelsAdded information on how to enable signed/unsigned conversion warnings for Visual Studio
2023 May 5Split
10.4 -- Narrowing conversions, list initialization, and constexpr initializersRefactored narrowing conversion content from prior lesson. Added content around constexpr initializers.
2023 May 5Revision
10.3 -- Numeric conversionsAdded section: Safe and unsafe conversions
2023 May 4Revision
11.9 -- Non-type template parametersAdded sections: Implicit conversions for non-type template arguments, and Type deduction for non-type template parameters using `auto`
2023 Apr 22Revision
1.6 -- Uninitialized variables and undefined behaviorAdded section: Implementation-defined behavior and unspecified behavior
2023 Apr 21Split
11.9 -- Non-type template parametersRefactored content and added examples (in preparation for future content)
2023 Apr 13Revision
6.3 -- Remainder and ExponentiationRenamed modulus to remainder, added rationale
2023 Mar 30New
21.y -- Chapter 21 projectAdded project: Chapter 14 project
2023 Mar 16Revision
23.7 -- std::initializer_listRevised section: List initialization prefers list constructors over non-list constructors
2023 Feb 27Revision
8.14 -- Generating random numbers using Mersenne TwisterRevised section: Random numbers across multiple functions or files (Random.h)
2023 Feb 12Revision
13.14 -- Class template argument deduction (CTAD) and deduction guidesAdded section: Type template parameters with default values
2023 Feb 8Revision
5.12 -- std::string_view (part 2)Revised section: Prefer to pass by std::string_view (over const std::string&)
2023 Feb 6Revision
12.7 -- Introduction to pointersClarified when invalid pointers produce undefined/implementation-defined behavior
2023 Jan 26Revision
27.9 -- Exception specifications and noexceptAdded section: Illustrating the behavior of noexcept functions and exceptions
2023 Jan 13Revision
1.5 -- Introduction to iostream: cout, cin, and endlAdded section: std::cout is buffered, along with additional discussion of flushing
2023 Jan 7Revision
0.6 -- Installing an Integrated Development Environment (IDE)Added instructions to update MinGW for Code::Blocks C++20 support
2023 Jan 7Revision
1.9 -- Introduction to literals and operatorsAdded discussion of operator return values and side effects
2022 Dec 21Revision
2022 Dec 17Revision
21.11 -- Overloading typecastsAdded section: Converting constructors vs overloaded typecasts
2022 Dec 8Revision
SiteAdded VS Code sections
2022 Nov 29Revision
1.4 -- Variable assignment and initializationAdded section: Unused initialized variables and [[maybe_unused]]
2022 Nov 23Revision
22.7 -- Circular dependency issues with std::shared_ptr, and std::weak_ptrRewrote section: Avoiding dangling pointers with std::weak_ptr
2022 Nov 21Revision
2022 Nov 5Revision
2022 Oct 6Revision
27.4 -- Uncaught exceptions and catch-all handlersNoted that stack unwinding is optional for uncaught exceptions. Added best practice around catch-all handlers in main.
2022 Oct 6Revision
27.3 -- Exceptions, functions, and stack unwindingRevised lesson to more accurately describe when stack unwinding happens
2022 Oct 3Revision
22.4 -- std::moveAdded section: Moved from objects will be in a valid, but possibly indeterminate state
2022 Oct 3Revision
22.3 -- Move constructors and move assignmentAdded section: Do not implement move semantics using std::swap
2022 Sep 16Revision
21.10 -- Overloading the parenthesis operatorAdded extra credit quiz questions 2 and 3
2022 Sep 15Revision
8.10 -- For statementsAdded section: The perils of `operator!=` in for-loop conditions
2022 Sep 13Revision
10.7 -- Typedefs and type aliasesAdded section on naming type aliases, made type alias names consistent with best practice
2022 Sep 12Revision
4.12 -- Introduction to type conversion and static_castAdded section: Type conversion produces a new value
2022 Sep 11Revision
5.5 -- Constant expressionsRevised examples, added section: Constant folding for constant subexpressions
2022 Sep 8Revision
1.10 -- Introduction to expressionsRefactored some content and linked some related lessons
2022 Sep 8Revision
1.9 -- Introduction to literals and operatorsAdded text about nullary operators
2022 Aug 25Revision
14.10 -- Constructor member initializer listsAdded section: Initializing const member variables
2022 Aug 23Revision
2022 Aug 23Revision
13.1 -- Introduction to program-defined (user-defined) typesRevised section: Nomenclature: user-defined types vs program-defined types
2022 Aug 20Revision
27.9 -- Exception specifications and noexceptRevised section: When to use noexcept
2022 Aug 12Revision
6.6 -- Relational operators and floating point comparisonsRevised section: Floating point equality
2022 Jul 23Revision
22.7 -- Circular dependency issues with std::shared_ptr, and std::weak_ptrAdded section: Dangling pointers with std::weak_ptr
2022 Jul 21Revision
24.9 -- Multiple inheritanceAdded section: Mixins
2022 Jun 16Split
5.12 -- std::string_view (part 2)Moved some content into chapter 4
2022 Jun 16Moved
2022 Jun 16Revision
2022 Jun 16Split
5.3 -- Numeral systems (decimal, binary, hexadecimal, and octal)Refactored from literals lesson. Made lesson optional
2022 Jun 16Revision
5.2 -- LiteralsRevised content for clarity. Moved content on numeric systems and string literals to other lessons
2022 Jun 16Split
5.5 -- Constant expressionsExpanded constexpr content. Added section around constant expressions
2022 Jun 16Revision
5.1 -- Constant variables (named constants)Revised content for clarity. Moved constexpr content to new lesson
2022 May 13Revision
5.1 -- Constant variables (named constants)Added section on constexpr strings
2022 Apr 26Revision
9.5 -- std::cin and handling invalid inputChanged occurrences of `std::cin.fail()` to `!std::cin`.
2022 Apr 24New
13.14 -- Class template argument deduction (CTAD) and deduction guidesMoved CTAD from lesson 10.10 and added deduction guides section
2022 Apr 21Revision
2022 Apr 21New
2022 Apr 15New
2.3 -- Void functions (non-value returning functions)Moved some content from lesson 2.2. Added more discussion about return statements
2022 Apr 15Split
2.2 -- Function return values (value-returning functions)Moved some content of this lesson into lesson 2.3
2022 Apr 8Moved
SiteSplit chapter 9 (into 9 and 10). Previous chapters 10, 11, 12, 13 moved back.
2022 Mar 29Revision
11.7 -- Function template instantiationAdded section: Using function templates in multiple files
2022 Mar 29Moved
5.8 -- Inline functions and variablesMoved lesson from chapter 10 to chapter 6
2022 Mar 28New
5.9 -- Constexpr and consteval functionsNew lesson: Constexpr and consteval functions
2022 Mar 27Revision
5.1 -- Constant variables (named constants)Added new section: "Constant expressions"
2022 Mar 20Revision
2.5 -- Introduction to local scopeAdded section: "Out of scope" vs "going out of scope"
2022 Mar 20Revision
5.11 -- Introduction to std::string_viewAdded sections: converting std::string to std::string_view, and passing strings to functions
2022 Mar 14Revision
5.8 -- Inline functions and variablesRewrote lesson, added section on use of inline keyword in modern C++
2022 Feb 27Revision
0.10 -- Configuring your compiler: Compiler extensionsRemoved /Za as recommended setting for Visual Studio
2022 Feb 25Revision
13.6 -- Scoped enumerations (enum classes)Added section: Easing the conversion of scoped enumerators to integers (advanced)
2022 Feb 20Revision
2022 Feb 20Revision
2022 Feb 20Revision
2022 Feb 20Feature
SiteStarted Changelog

Any web designers want to help restyle the above to make it more readable while remaining thematically consistent? Reach out via the contact form. Thanks!

guest
Your email address will not be displayed
Find a mistake? Leave a comment above!
Correction-related comments will be deleted after processing to help reduce clutter. Thanks for helping to make the site better for everyone!
Avatars from https://gravatar.com/ are connected to your provided email address.
Notify me about replies:  
75 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments