Re: STL and "function try blocks"
- From: "Babak Pourat" <pourat@xxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 27 Feb 2006 09:14:22 +0100
Carl Daniel [VC++ MVP] wrote:
Function try
blocks have no value except for in constructors, as the contents of
the constructor-initializer-list is inside the function try block,
but outside the function body.
I'm not sure, but I expect thay have sence in destructors too. Thay should
catch exceptions in objects with automaticly called destructors(I know,
exceptions in destructors are evil!).
e.g.:
#include <iostream>
class Y{
public:
~Y(){
throw 0;
}
};
class X{
Y y;
public:
~X()try{
}
catch (int &) {
std::cout << "exception catched\n";
}
};
.
- References:
- STL and "function try blocks"
- From: Babak Pourat
- Re: STL and "function try blocks"
- From: mzdude
- Re: STL and "function try blocks"
- From: Carl Daniel [VC++ MVP]
- STL and "function try blocks"
- Prev by Date: Re: can't open a file in vc++ 6
- Next by Date: Re: STL and "function try blocks"
- Previous by thread: Re: STL and "function try blocks"
- Next by thread: Re: STL and "function try blocks"
- Index(es):
Relevant Pages
|