C
Chris Newcombe
Please could someone on the VC++ 7.0 compiler team (note; not 7.1)
tell me if this code is handled 'correctly' (i.e. as the original
poster suggests) in all cases?
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&[email protected]
(Incase the URL doesn't make it I've copied it below.)
I have a situation where I really need this technique. But the fact
that Dave Abrahams wasn't sure about it very much worries me...
Many thanks,
Chris Newcombe, Valve Software.
------------
From: "Bill Wade" <[email protected]>
Subject: Defect Report: Rethrowing "finished" exception?
Date: 2000/02/29
Message-ID: <[email protected]>#1/1
Newsgroups: comp.std.c++
Paragraph seven of "15.1 Throwing an exception" [except.throw]
discusses which exception is thrown by a throw-expression with no
operand.
May an expression which has been "finished (15.1p7)" by an inner catch
block be rethrown by an outer catch block?
catch(...) // Catch the original exception
{
try{ throw; } // rethrow it at an inner level (in reality this is
probably inside a function)
catch (...)
{
} // Here, an exception (the original object) is "finished"
according to 15.1p7 wording
// 15.1p7 says that only an unfinished exception may be rethrown.
throw; // Can we throw it again anyway? It is certainly still
alive (15.1p4).
}
I believe this is ok, since the paragraph says that the exception is
finished when the "corresponding" catch clause exits. However since
we have two clauses, and only one exception, it would seem that the
one exception gets "finished" twice.
tell me if this code is handled 'correctly' (i.e. as the original
poster suggests) in all cases?
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&[email protected]
(Incase the URL doesn't make it I've copied it below.)
I have a situation where I really need this technique. But the fact
that Dave Abrahams wasn't sure about it very much worries me...
Many thanks,
Chris Newcombe, Valve Software.
------------
From: "Bill Wade" <[email protected]>
Subject: Defect Report: Rethrowing "finished" exception?
Date: 2000/02/29
Message-ID: <[email protected]>#1/1
Newsgroups: comp.std.c++
Paragraph seven of "15.1 Throwing an exception" [except.throw]
discusses which exception is thrown by a throw-expression with no
operand.
May an expression which has been "finished (15.1p7)" by an inner catch
block be rethrown by an outer catch block?
catch(...) // Catch the original exception
{
try{ throw; } // rethrow it at an inner level (in reality this is
probably inside a function)
catch (...)
{
} // Here, an exception (the original object) is "finished"
according to 15.1p7 wording
// 15.1p7 says that only an unfinished exception may be rethrown.
throw; // Can we throw it again anyway? It is certainly still
alive (15.1p4).
}
I believe this is ok, since the paragraph says that the exception is
finished when the "corresponding" catch clause exits. However since
we have two clauses, and only one exception, it would seem that the
one exception gets "finished" twice.