In this final example, we will demonstrate that C++ exceptions outperform POSIX-style exceptions (a claim that is largely dependent on the hardware you're executing on, as compiler optimizations and aggressive branch prediction can improve the performance of POSIX-style error handling).
POSIX-style error handling requires the user to check the result of a function each time it is executed. When function nesting occurs (which will almost certainly happen), this issue is exacerbated even further. In this example, we will take this case to the extreme, creating a recursive function that checks the results of itself thousands of times, while executing the test hundreds of thousands of times. Each test will be benchmarked and the results will be compared.
There are a lot of factors that could change the results of this test, including...