Re: Unhandled exception - How to turn off!
- From: Tamas Demjen <tdemjen@xxxxxxxxx>
- Date: Wed, 21 Mar 2007 10:19:50 -0700
Vladimir Nesterovsky wrote:
bad_cast,
bad_exception,
bad_typeid,
terminate,
type_info,
uncaught_exception,
unexpected
all these functions and classes are deeply language bounded, and reside in the std namespace.
Yes, in some cases the compiler implicitly calls std library functions, such as uncaught_exception or unexpected. The compiler has every right to generate implicit function calls. Those two functions, however, are the dark side of C++, and the general consensus is that it's better to avoid them. I wouldn't touch uncaught_exception or exception specifiers with a 10-foot pole:
http://www.gotw.ca/gotw/047.htm
http://www.gotw.ca/gotw/082.htm
Sometimes it is necessary for the compiler to implicitly call a function, when a feature can't be implemented in any other way. For example, dynamic_cast operating on reference types has no other choice but to throw std::bad_cast on error. However, bad_cast is still a std library feature, implemented as an external .lib. It's just that the compiler is allowed to implicitly generate certain calls to the std library.
There are certainly some functions that enjoy special treatment, such as main. But this is being kept to an absolute minimum. For example, it is wise that a string literal is a character array, and not an std::string.
The only time the compiler forces a special memory layout on you is with type_info, in which case it's inevitable. Many people argue that the current type_info feature is not extensive enough, and to fully implement reflection, the compiler would have to build some user accessible data types, there's no way around it. I don't think it would violate the main design philosophy of the language.
Tom
.
- Follow-Ups:
- Re: Unhandled exception - How to turn off!
- From: Vladimir Nesterovsky
- Re: Unhandled exception - How to turn off!
- References:
- Unhandled exception - How to turn off!
- From: David F.
- Re: Unhandled exception - How to turn off!
- From: Ben Voigt
- Re: Unhandled exception - How to turn off!
- From: Ulrich Eckhardt
- Re: Unhandled exception - How to turn off!
- From: Ben Voigt
- Re: Unhandled exception - How to turn off!
- From: Ulrich Eckhardt
- Re: Unhandled exception - How to turn off!
- From: Ben Voigt
- Re: Unhandled exception - How to turn off!
- From: Vladimir Nesterovsky
- Unhandled exception - How to turn off!
- Prev by Date: Re: Monitor a directory using WaitForMultipleObjects
- Next by Date: interrupting build on failures
- Previous by thread: Re: Unhandled exception - How to turn off!
- Next by thread: Re: Unhandled exception - How to turn off!
- Index(es):
Relevant Pages
|