Clarifications on Exception Handling

Clarifications on Exception Handling - Clarifications on...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Clarifications on Exception Handling Jonathan Schilling, jls@sco.com The ANSI/ISO C++ standards meeting earlier this month in Nashua, New Hampshire, produced some clarifications of exception handling semantics. One interesting case is this one, which was featured in the January 1997 issue of the magazine C++ Report: try { // exception prone code here, that may do a throw } catch (...) { // common error code here try { throw; // re-throw to more specific handler } catch (ExceptA&) { // handle ExceptA here } catch (ExceptB&) { // handle ExceptB here } catch (...) { // handle unknown exceptions here } throw; } The idea behind the code is to factor out common error handling logic into the first part of the catch handler (so as not to replicate it), rethrow the exception to get error handling specific to the exception in the individual inner handlers, and then finally to rethrow the exception again to let functions further up the call chain do their handling....
View Full Document

This note was uploaded on 02/27/2012 for the course CS 251 taught by Professor Staff during the Fall '08 term at Purdue University-West Lafayette.

Page1 / 2

Clarifications on Exception Handling - Clarifications on...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online