(don't) Copy Paste All The Things
summary
Argument: copying a boilerplate move constructor without noexcept and without thinking about destructor behavior leads to real bugs. Example: operator move assign invokes a destructor that throws, unwinds past the intended catch, and an exception-on-construction path produces a double free when cleanup runs. The demonstrator uses a small main and catches nothing useful, reproduces heap corruption, and finds the issue with AddressSanitizer.
AI-written summary · about
chapters (6)
- 0:00Start
- 0:32And I was thinking
- 1:27Fun case #1: throwing destructor
- 1:52Test Driver
- 2:03And that's what happens
- 2:37Fun case #2: exception on construction
related talks
01h 02mBack to Basics: C++ Move Semantics
01h 04mBack to Basics: Move Semantics
01h 02mBack To Basics: The Special Member Functions
01h 06mThe Canonical Class
01h 01mException-Safe Code, Part I
01h 10mAn Overview of C++11/14, Part II
01h 04mException-Safe Code, Part III
24mMove Constructors: Is it Possible?
