Article View: comp.std.c++
Article #3703Re: Exception handling -- was a finally block ever considered?
From: Jason D. Morris
Date: Sun, 17 Mar 1996 03:57
Date: Sun, 17 Mar 1996 03:57
40 lines
2000 bytes
2000 bytes
On 16 Mar 96 10:13:46 GMT, ebiederm@cse.unl.edu (Eric W. Biederman)
wrote:
>This can be written quite easily as I see it with C++, though the
>structure is a little awkward.
>
>Basically you just need to write a destructor. The code ordering is a
>little less pleasant
>Say,
>
>func( ... )
>{
> class finally{
> public:
> ~finally()
> {
> // code that would be guaranteed to execute no matter how the
> // function was exited.
> } finally;
> try
> {
> // some code that could generate an exception...
> }
> catch ( // some expected exception type )
> {
> // handler code
> }
>}
Ok, but that still doesn't answer my question. I didn't ask for a
method for simulating a finally block, I asked if the committee had
considered a finally block as part of the exception handling
mechanism, and if they had, why it wasn't adopted.
Jason
---
[ 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 ]
Technical Details
Message-ID:
<314b1f7b.6864220@nntp.ix.netcom.com>Path:
arc1-ca.pugleaf.net!in1.uu.net!bounce-backReferences:
<31475017.8100207@nntp.ix.netcom.com> <ERIC.96Mar15153848@cse.unl.edu>Show Full Headers
Complete Article Headers
From: jdmorris@ix.netcom.com (Jason D. Morris) Message-ID: <314b1f7b.6864220@nntp.ix.netcom.com> X-Original-Date: Sat, 16 Mar 1996 20:09:40 GMT Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back Date: 17 Mar 96 03:57:19 GMT Approved: fjh@cs.mu.oz.au Newsgroups: comp.std.c++ Subject: Re: Exception handling -- was a finally block ever considered? Organization: Netcom References: <31475017.8100207@nntp.ix.netcom.com> <ERIC.96Mar15153848@cse.unl.edu> X-Netcom-Date: Sat Mar 16 12:08:53 PM PST 1996 X-Newsreader: Forte Agent .99d/32.182 X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMUuNq+EDnX0m9pzZAQG1LQGAi5BRMpvQNYbUe1u4Qx/LfRrgE5ut507g 2mKazLCXOC0Rhh3rjbGR/8oas0gv9Y1a =7MTH