Author: Vincent Vega
Date: 18:20:36 06/01/00
Go up one level in this thread
On June 01, 2000 at 13:02:15, KarinsDad wrote:
>In my code, I have something similar to the following:
>
>while (bIsRunning)
>{
> try
> {
> Function1();
> }
> catch(CException* e)
> {
> ReportError(e);
> e->Delete();
> }
> catch(...)
> {
> ReportError();
> }
>}
>
>Function1 calls some Win32 API calls and I think that one of them throws a
>non-C++ exception (i.e. it does not get caught in the catch(CException* e) code
>above). Since this is in a loop, the exception does not get deleted (like a C++
>exception would get deleted in the code above), so once Function1 throws a
>non-C++ exception, this code (catch(...)) reports it, loops back, immediately
>finds an exception within the Try block, and reports the exception again
>(effectively infinitely looping).
>
>However, this appears to only happen with certain exceptions, but not all
>exceptions (for example, if I just try to replace Function1 with a throw myself,
>I cannot reproduce this behavior).
>
>Does anyone have an idea on how to get rid of an exception caught within the
>catch(...)?
>
>Thanks,
>
>KarinsDad :)
Sure, use TRY and CATCH (note capitals). Microsoft wanted to add exceptions
before their C++ compiler supported them and that's what they added to MFC.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.