Better Code: Exploring Validity in C++
summary
Defines validity as a relation to an operation and gives precise labels: discardable for objects safe only to destroy or assign, meaningless for moved‑from or minimally exception‑safe objects, and class invariant for predicates that must hold. Uses concrete C++ examples — SSO strings, std::unique_ptr with delete p.get followed by p.release, a hash map xored with a global seed, std::move and make_unique — and draws practical rules for preconditions, postconditions, and when to check invariants.
AI-written summary · about
chapters (18)
- 0:00Introduction
- 2:07Defining validity
- 4:32Validity in C++
- 6:02Invalid pointers
- 7:34Argument validity practices
- 8:50Object state
- 12:24Object substance
- 16:09Behavior and substance
- 18:24Valid objects
- 21:41Class invariants
- 25:06Invariant rules
- 28:41Object essence
- 32:10Value types
- 35:18Meaningless objects
- 38:54Exception safety
- 41:02Summary of concepts
- 42:39Philosophical implications
- 44:58Q&A
related talks
54mCompile-Time Validation in C++ Programming
51mBack to Basics: Master C++ Value Categories With Standard Tools
58mUnderstanding and Mastering C++'s Complexity
01h 10mAn Overview of C++11/14, Part II
01h 01mBack to Basics: C++ API Design
01h 01mException-Safe Code, Part I
01h 02mBack to Basics: C++ Move Semantics
01h 05mThe real problem of C++
