Topic: Stack of exceptions?


Author: Valentin Bonnard <bonnardv@pratique.fr>
Date: 1998/06/26
Raw View
Valentin Nechayev <netch@lucky.net> writes:

Hello Valentin !

> The question: does the stack of exceptions exist in C++ realizations
> conforming to standard?

> One opinion is that it is possible and correct; another says that attempt to
> throw another exception in body of catch block must fail with terminate().
> What opinion is right?

You can have an arbitrary number of exceptions active in a C++
program at the same time. Where the implementation store the
exception objects in unspecified, but something at least as
powerfull as a stack is need.

--

Valentin Bonnard                mailto:bonnardv@pratique.fr
info about C++/a propos du C++: http://pages.pratique.fr/~bonnardv/
---
[ 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              ]





Author: netch@lucky.net (Valentin Nechayev)
Date: 1998/06/25
Raw View
Hello!

The question: does the stack of exceptions exist in C++ realizations
conforming to standard?

Consider the following:

class Ex_t {};
class Ex2_t {};

void f() {
    try {
        throw Ex_t();
    }
    catch( Ex_t& Ex ) {
        try {
            throw Ex2_t();
        }
        catch( Ex2_t& Ex2) {
            ...
        }
        throw; // this rethrow the Ex, neither the Ex2 nor another
    }
}

One opinion is that it is possible and correct; another says that attempt to
throw another exception in body of catch block must fail with terminate().
What opinion is right?

-- --
Valentin Nechayev
netch@lucky.net
2:463/1972.300


[ 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              ]