Topic: 15.3 item 13 Exception return point.
Author: Amin Manji <amin@ophelia.telecom.com.au>
Date: 1996/08/02 Raw View
15.3
Item 13 says
The exception being handled shall be rethrown if control reaches the
end of a handler of the function-try-block of a constructor or
destructor. Otherwise, the function shall return when control reaches
the end of a handler for the function-try-block
Does the first part mean that the rethrow point is Location A and code
at and below Location B is never executed.
A::A()
{
try
{
// do something
}
catch (someexception)
{
// do something
} // <-- Is this the RETHROW point? Location A
// Any code here not executed ?? Location B
}
Does the second part mean that Location C is the return point and the
code at location D is never executed?!?!?
func1()
{
try
{
// do something
}
catch (someexception)
{
// do something
} // <-- Is this the return point?!?! Location C
// More code. Location D
}
---
[ 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 ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
Date: 1996/08/02 Raw View
In article <u0wwziwe6d.fsf@ophelia.telecom.com.au> Amin Manji
<amin@ophelia.telecom.com.au> writes:
|> 15.3
|> Item 13 says
|> The exception being handled shall be rethrown if control reaches the
|> end of a handler of the function-try-block of a constructor or
^^^^^^^^^^^^^^^^^^
Note this wording!
|> destructor. Otherwise, the function shall return when control reaches
|> the end of a handler for the function-try-block
|> Does the first part mean that the rethrow point is Location A and code
|> at and below Location B is never executed.
No, because there is no function-try-block in the following code.
|> A::A()
|> {
|> try
|> {
|> // do something
|> }
|> catch (someexception)
|> {
|> // do something
|> } // <-- Is this the RETHROW point? Location A
|> // Any code here not executed ?? Location B
|> }
|> Does the second part mean that Location C is the return point and the
|> code at location D is never executed?!?!?
No, because there is no function-try-block in the following code.
|> func1()
|> {
|> try
|> {
|> // do something
|> }
|> catch (someexception)
|> {
|> // do something
|> } // <-- Is this the return point?!?! Location C
|> // More code. Location D
|> }
A function try block is a new feature introduced by the standards
committee, and in all likelyhood not supported by your compiler. Since
the handler in a function try block is situated outside of the function
(constructor, destructor), it is good that the standard will say what
happens when you reach the end of it.
--
James Kanze Tel.: (+33) 88 14 49 00 email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
Conseils, itudes et rialisations en logiciel orienti objet --
-- A la recherche d'une activiti dans une region francophone
---
[ 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 ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: b91926@fsgi02.fnal.gov (David Sachs)
Date: 1996/08/04 Raw View
kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763) writes:
...
>A function try block is a new feature introduced by the standards
>committee, and in all likelyhood not supported by your compiler. Since
>the handler in a function try block is situated outside of the function
>(constructor, destructor), it is good that the standard will say what
>happens when you reach the end of it.
I like the idea of function try blocks, which are really needed only
for contructors and destructors. The function try block, allows these
special functions to handle exceptions that arise outside the
function body (i.e. in the contructor/destructor of a member or a
base class). Previously this was impossible.
--
** The Klingons' favorite food was named by the first earthling to see it **
David Sachs - Fermilab, MSSG MS369 - P. O. Box 500 - Batavia, IL 60510
Voice: 1 708 840 3942 Deparment Fax: 1 708 840 3785
---
[ 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 ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]