~/talk

Exception-Safe Code, Part I

Talkat CppCon 2014 · on Tuesday, 2014-09-09· at 14:00· Descartes· [rust]
name:Jon Kalb
github:boostcon
slides:none on file

Covers concrete rules and examples: the basic/strong/nothrow guarantees, when no‑throw is required (destructors, cleanup, swap/move), and how RAII or move semantics prevent leaks and broken invariants. Shows STL patterns that solve real problems (vector push_back vs insert, stack pop/top), explains why catch by reference and throwable types must be copyable, and gives a compact set of guidelines plus implementation techniques. Slides and source live at https://github.com/CppCon/CppCon2014, C++11/14 focused.

AI-written summary · about

  1. 0:00Start
  2. 12:45Problems with the Return Code Approach • Errors can be ignored • Are ignored by default • If a single call "breaks the chain" by not retuming an error errors cases are lost • Code is tedious to read and write • Exception based coding addresses both of these issues... ... but has issues of its own.
  3. 29:35First Steps • Carefully check return values/error codes to detect and correct problems • Identify functions that can throw and think about what to do when they fail • Use exception specifications so the compiler can help create sale code. • Use try/catch blocks to control code flow
  4. 30:54Think structurally • Maintain invariants
~/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.