Sometimes, things go wrong when code executes. You can't predict when this will happen or even why, but you can write code to handle exceptional problems. If you're lucky, the problem will carry with it a bunch of useful information that you can use, at
runtime, to handle the specific error. These exceptional information structures are called structured exceptions; blobs of bad news carrying useful and specific information that you can use to find your way out of the exceptional rabbit hole. Of course, with
useful data packaged up in an exception you can more easily debug to find root causes, which is much harder to do with, say, error codes...
What is a structured exception, exactly? How should you handle exceptions that you don't assume will arise during the execution of your code? What are the correct patterns of exception handling that you can safely rely on? What does the C++ compiler have to
do with exception code patterns?
Come along for ride into the deep and murky world of exceptions with some folks that truly understand them at the most fundamental levels.
Ale Contenti is a senior development lead in the C++ base class libraries team. Louis Lafreniere is a principal software developer in the C++ compiler group. Here, Ale and Louis teach us about exceptions and handling them (and when not to handle them). I love
talking to the
. They live on the metal and really understand the fascinating intracacies of our platform.
Enjoy this latest Going Deep