~/talk

Back to Basics: RAII in C++

Talkat CppCon 2022 · 2022-09-11..09-16· [rust]
links:none on file
slides:none on file

Claims that RAII, when applied correctly, eliminates leaks, use-after-release and double disposal for most resources and demonstrates this with std::lock_guard, std::unique_ptr and std::jthread examples. Builds a C FILE wrapper using a unique_ptr with custom deleter and a bespoke make_c_file factory, and shows a unique_unlock RAII utility that works. Explains design tradeoffs: default-empty state, copy/move/delete semantics, whether to expose raw handles, and the hard limitation that destructors cannot reliably report release failures.

AI-written summary · about

  1. 0:00Introduction to RAII
  2. 0:33Defining resources
  3. 1:16Common resource types
  4. 2:13Resource management issues
  5. 3:38Manual resource handling
  6. 6:16RAII concept and ownership
  7. 7:56Standard RAII examples
  8. 10:49Storage durations
  9. 12:04Smart pointers and threads
  10. 13:50Accessing raw resources
  11. 15:44Evaluating RAII benefits
  12. 17:08RAII limitations
  13. 19:22Implementing custom RAII
  14. 22:19Factory functions for RAII
  15. 25:12RAII class design decisions
  16. 27:55Copy and move semantics
  17. 30:19Advanced RAII design
  18. 32:32Custom RAII example
  19. 34:22Core guidelines and recap
  20. 35:54Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.