By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,907 Members | 1,283 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,907 IT Pros & Developers. It's quick & easy.

operator new local to a class is required ?

P: n/a
Hello

I have just read (in a MSDN article named Deep C++, in part 8) that
member functions operator new and operator delete (and operator new[]
and operator delete[]) are required in order to have the language
automaticaly delete a memory bloc alocated with _new_ after the
constructor for the new object throws.

Is it true that only class delete is called in a new expresion to free
memory after the constructor throw ?

I am trying to write an exception-safe application. Idealy the app will
never crash, but will pop-up a message box and exit gracefully with full
clean-up if a fatal error like access violation occurs, be it anywhere
in the flow of control in my app. However I find this to be such a
difficult task to do !! It is ever more complicated.

Do you know of a good book that will fully explain to me how to
effectively use exception-handling in a real application ? The problem
gets even worse if you work with the odd code and design required by
Win32 and Win32 GUI...

Thank you
Timothy Madden
Romania
Oct 31 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Timothy Madden wrote:
Hello

I have just read (in a MSDN article named Deep C++, in part 8) that
member functions operator new and operator delete (and operator new[]
and operator delete[]) are required in order to have the language
automaticaly delete a memory bloc alocated with _new_ after the
constructor for the new object throws.
I've just read that article and I can't see what you read that made you
come to that conclusion.

Is it true that only class delete is called in a new expresion to free
memory after the constructor throw ?
No.

I am trying to write an exception-safe application. Idealy the app will
never crash, but will pop-up a message box and exit gracefully with full
clean-up if a fatal error like access violation occurs, be it anywhere
in the flow of control in my app. However I find this to be such a
difficult task to do !! It is ever more complicated.
There is no doubt, it is a difficult task. You do have to consider
whether the effort needed is worth it.

Do you know of a good book that will fully explain to me how to
effectively use exception-handling in a real application ? The problem
gets even worse if you work with the odd code and design required by
Win32 and Win32 GUI...


There is the Exceptional C++ series by Herb Sutter, personally I hate
the style but they do contain good information.

John
Oct 31 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.