Difference between revisions of "Intermediate C++ Game Programming Tutorial 22"
From Chilipedia
(→Video Timestamp Index) |
(→Video Timestamp Index) |
||
Line 19: | Line 19: | ||
* Comparing error handling with and without exceptions [https://youtu.be/DMdyz0lrFBI?t=1m40s 1:40] | * Comparing error handling with and without exceptions [https://youtu.be/DMdyz0lrFBI?t=1m40s 1:40] | ||
** Conventional error handling requires checking function return errors for every funnction throughout the entire hierarchy of the code base | ** Conventional error handling requires checking function return errors for every funnction throughout the entire hierarchy of the code base | ||
− | ** With exceptioins, you can catch an error anywhere in the code base (they "bubble up", or propagate up to the next function) and you can seperate your | + | ** With exceptioins, you can catch an error anywhere in the code base (they "bubble up", or propagate up to the next function) and you can seperate your normal logic (code) from your error handling. |
+ | =: if you don't handle the error at some point, your program will be halted | ||
* WORK-IN-PROGRESS | * WORK-IN-PROGRESS | ||
[https://youtu.be/_6G5yDgoWiA Tutorial 22 Part 2] | [https://youtu.be/_6G5yDgoWiA Tutorial 22 Part 2] |
Revision as of 04:42, 11 November 2019
In this video we learn how to use C++ exceptions to take our error handling to the next level. There is a lot of fear and ignorance surrounding exceptions among "C++ Programmers", and Chili's goal here is to elevate you guys above the shit-tier level to coders who can actually use this feature to its full extent. The second part of this tutorial will give concrete, practical examples of using exceptions in an actual game scenario.
Topics Covered
- Basic exception
try
ingthrow
ing andcatch
ing - Exceptions 'bubbling up'
- Rethrowing with
throw
-
std::exception
and its derivatives - Polymorphism in exception handling
-
catch(...)
- Throw by value, catch by
const
reference - Exceptions and destructors
-
noexcept
and move constuctors vs. standard containers
Video Timestamp Index
- Intro: exceptions are the main way of handling errors in C++ 0:10
- Examples of its usage in the Framework, a good practice for working with any API
- Everytime a Direct 3D Function is called, the return value is checked for error codes and handled
- Comparing error handling with and without exceptions 1:40
- Conventional error handling requires checking function return errors for every funnction throughout the entire hierarchy of the code base
- With exceptioins, you can catch an error anywhere in the code base (they "bubble up", or propagate up to the next function) and you can seperate your normal logic (code) from your error handling.
=: if you don't handle the error at some point, your program will be halted
- WORK-IN-PROGRESS
Extra Discussion
I had an interesting exchange with a viewer, and made a bit of a writeup here: essay time.