Re: Exception handling the right way
On Sep 9, 12:25 pm, Nick Keighley <nick_keighley_nos...@hotmail.com>
wrote:
On 9 Sep, 10:15, Bart Friederichs <b...@tbwb.nl> wrote:
Chris M. Thomasson wrote:
int main() {
std::auto_ptr<A> a(new A);
std::auto_ptr<B> b(new B);
std::auto_ptr<C> c(new C);
return 0;
}
This terminates when B() throws, simply adding the try-catch
around it seems to fix that.
the whole point is to avoid a try-catch!
There's no point in using exceptions if you don't have a
try/catch somewhere. Typically, the main function is the place,
at least in single threaded applications.
What do you mean it terminates? The program will terminate
whether new B throws or not.
But it will not terminate in the same manner.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34