new & exception handling
From: <- Chameleon -> (cham_gss_at_hotmail.NOSPAM.com)
Date: 11/30/03
- Next message: Gianni Mariani: "Re: hash_map"
- Previous message: P.J. Plauger: "Re: hash_map"
- Next in thread: Deming He: "Re: new & exception handling"
- Reply: Deming He: "Re: new & exception handling"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 30 Nov 2003 19:55:30 +0200
I have this code:
---------------------
try {
int *a = new int[1000000000];
} catch (...)
{
cout << "oh no!"; exit(0);
}
----------------------
new returns 0 but no exception occur in this error. Why?
============
I learn today about auto_ptr. What is the use of this? (I have not
understand it well)
if I want automatic deletion of int array inside a class constructor on
exception I must use it like this?
-------------------------
auto_ptr<int> array_of_int(new int(100));
-------------------------
thanks
- Next message: Gianni Mariani: "Re: hash_map"
- Previous message: P.J. Plauger: "Re: hash_map"
- Next in thread: Deming He: "Re: new & exception handling"
- Reply: Deming He: "Re: new & exception handling"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|