> I'm not familiar with TRY\CATCH. I supose it's some M$ non-
> standardisation. You certainly don't have to delete exception objects
> on stanrd C++ (try\catch) unless of course you throw an exception that
> is allocated on the heao and (in C++) that is just mad!

Actually, the TRY/CATCH family of macros date before the introduction of the
exceptions into the language.  They're used in MFC source code to make it
backwards compatible, but now they're implemented in terms of try/catch.
For new code, it is preferrable to use try/catch.

The MFC exception mechanism dictates an exception to be allocated on the
heap, and then thrown, and the Delete() member function is used to delete
the object (it effectively does a "delete this;".)  That's what you should
do if you derive from CException.  If you don't (and I suggest you don't),
you can allocate the exception object on the stack, and then not worry about
its deletion, like I showed in my example.

-------------
Ehsan Akhgari

Farda Technology (http://www.farda-tech.com/)

List Owner: [EMAIL PROTECTED]

[ Email: [EMAIL PROTECTED] ]
[ WWW: http://www.beginthread.com/Ehsan ]

Freedom from fever is still far from being knowledge! Refrigerated spirits I
do not believe in. He who cannot lie, does not know what truth is.
-Thus Spoke Zarathustra, F. W. Nietzsche




_______________________________________________
msvc mailing list
[EMAIL PROTECTED]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription 
changes, and list archive.

Reply via email to