Skip to content
0:00 / 0:00

#raii#ruleofzero#arthuro'dwyer

Back to Basics: RAII and the Rule of Zero - Arthur O'Dwyer - CppCon 2019

CppCon

189K subscribers • 101 videos on Hallway • Conference channel

YouTube
  • One of the most-watched uploads on CppCon, a conference or university channel Hallway lists. Nobody has recommended it in the communities yet, so it ranks below community picks.
  • Presented by Arthur O'Dwyer
  • Linked in the descriptionCppCon/CppCon2019

Beginner. No background in the topic needed.

89K views7 years ago

Programming languagesSystems programmingC++Memory management

Arthur O'Dwyer explains the fundamentals of Resource Acquisition Is Initialization and how the Rule of Zero helps avoid resource leaks.

CppCon.org — Discussion & Comments: reddit.com/r/cpp/ — Presentation Slides, PDFs, Source Code and other presenter materials are available at: github.com/CppCon/CppCon2019 — RAII, or "Resource Allocation is Initialization," is one of the cornerstones of C++. What is it, why is it important, and how do we use it in our own code? Small resource-managing classes should follow the Rule of Three (or Five); larger, composite, business-logic classes should follow the Rule of Zero. We'll explain these "Rules," what they mean, and how their consistent application helps us avoid resource leaks and double-frees. We'll also show how thinking about the Rule of Three can lead to a consistent guideline for polymorphic classes with virtual destructors. Finally, we'll touch on the "copy and swap" idiom, which in many cases can reduce the Rule of Five to the Rule of Four (and a Half). Attendees will leave this session with a clearer understanding of resource management in C++. — Arthur O'Dwyer New York Arthur O'Dwyer is the author of "Colossal Cave: The Board Game," "Mastering the C++17 STL" (the book), and "The STL From Scratch" (the training course). He runs professional C++ training courses, is occasionally active on the C++ Standards Committee, and has a blog mostly about C++. — Videos Filmed & Edited by Bash Films: BashFilms.com Work at Hudson River Trading (HRT): tinyurl.com/safxfctf

Why it's here

A top upload from a listed channel

CppCon is on Hallway's list of conference and university channels, and this upload is one of its most-watched talks or lectures. Nobody has recommended it in the communities yet, so it ranks below community picks.