Topic: std::bad_exception and exception-specification
Author: Srinivas Vobilisetti <Srinivas.Vobilisetti@mci.com>
Date: 1997/12/02 Raw View
I have a question regarding std::bad_exception?
When a functions' exception-specification includes std::bad_exception,
is any exception not specified in the exception-specification of that
function and going out of that function automatically converted to
std::bad_exception or do we need to write a function which throws
std::bad_exception and set it as _unexpected_handler using function
set_unexpected()?
Thanks,
Srinivas
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: Jason Merrill <jason@cygnus.com>
Date: 1997/12/02 Raw View
>>>>> Srinivas Vobilisetti <Srinivas.Vobilisetti@mci.com> writes:
> I have a question regarding std::bad_exception?
> When a functions' exception-specification includes std::bad_exception,
> is any exception not specified in the exception-specification of that
> function and going out of that function automatically converted to
> std::bad_exception or do we need to write a function which throws
> std::bad_exception and set it as _unexpected_handler using function
> set_unexpected()?
The default unexpected handler just calls terminate. You'll need to
replace it with something that throws, though it doesn't need to throw
bad_exception; a simple rethrow will work. The compiler will then handle
turning it into a bad_exception.
Jason
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]