Topic: uncaught_exception() not implemented in MSVC5.0?


Author: "Mark Markaryan" <mmark@bway.net>
Date: 1998/07/11
Raw View
Did anyone have any luck using uncaught_exception() in MSVC50 (or any other
compiler for that matter)?

It appears that it is not working in MSVC5.0.

I want to use it in a class's destructor to find out whether objects are
destroyed becase of an excepion, or simply because the block ends.

class CTracer
{
    CTracer()
    { }

    ~CTracer()
    {
        if (uncaught_exception())
            cout << "Exception!"
    }
}

According to Microsoft's documentation to VC++ and other C++ documentation,
the following code should produce the "Exception!" message generated by
Tracer's destructor:

try
{
  CTracer Tracer;
  trow CExc();
}
catch (CExc)
{
}

Well, it does not. Why?

thanks,
markm :)
mmark@bway.net
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]