Should I Check for Null Here?
summary
Argument: null checks are a symptom, not the solution; adopt C++26 Contracts so pre/postconditions are code, not stale comments. The talk shows concrete handlers (ignore, observe, quicken/force, enforce), how a single contract handler logs or terminates, and tradeoffs with standard expected and optional vs exceptions. Examples: an Adobe “panic save” system that successfully preserves docs, a reusable any_tidy_ptr that spread and caused misuse, and a move‑only image type that improves performance but invites partial state.
AI-written summary · about
chapters (18)
- 0:00Introduction and it depends
- 1:14Null checks in real world
- 3:26Why check for null
- 7:43Robustness vs null checks
- 10:11Viral nature of null checks
- 12:37Undefined behavior risks
- 15:50Handling null errors
- 18:42Trusting program state
- 20:30Error handling strategies
- 27:11Reporting bugs to developers
- 31:48Default values and user experience
- 33:33Communicating errors to users
- 37:32Contracts in C++26
- 41:28Contract semantics and handlers
- 45:47Contract evaluation pitfalls
- 49:01Pit of success in contracts
- 50:17Why not both null checks and contracts
- 53:24Questions and wrap-up
