🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3632

Re: Exceptions: function-try-block

#3632
From: Steve Clamage
Date: Sun, 10 Mar 1996 02:36
46 lines
2176 bytes
dorgan@mtest.teradyne.com (Don Organ) writes:

>They way I interpret all of this is that the following
>should be legal:

>class X {
>public:
>	X(int arg1=0);

>	int member1;
>	int member2;
>};

>X::X(int arg1) try : member1(0), member2(0)
>{
>}
>catch (...) {};

>I.e. the try keyword precedes both the colon and the member initializer
>list and the catch keyword is not contained in a block.
>The catch handler would be entered if any exceptions were thrown
>either from the member initializers (not likely in this case since the
>members are simple types) are the body of the constructor.

That is correct.

>Is there any published material regarding usage of this form?

As far as I know, only the draft standard. This new form of try-block
was introduced to solve the problem of exceptions thrown during
member or base initialization, before the body of the constructor
is entered. Previously, there was no way to find out if any such
exceptions occurred or deal with them.

>Are there any compilers that support this form?

I don't know which ones support it yet, if any. Eventually all will.

--
Steve Clamage, stephen.clamage@eng.sun.com
---
[ 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: <4hs9e3$m1p@engnews1.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
References: <9603081943.AA02705@dawn.mtest>

Show Full Headers
Complete Article Headers
From: clamage@Eng.Sun.COM (Steve Clamage)
Message-ID: <4hs9e3$m1p@engnews1.Eng.Sun.COM>
X-Original-Date: 9 Mar 1996 15:51:31 GMT
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
Date: 10 Mar 96 02:36:49 GMT
Approved: fjh@cs.mu.oz.au
Newsgroups: comp.std.c++
Subject: Re: Exceptions: function-try-block
Organization: Sun Microsystems Inc., Mountain View, CA
References: <9603081943.AA02705@dawn.mtest>
X-Newsreader: NN version 6.5.0 #21 (NOV)
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMUJATeEDnX0m9pzZAQEtZgF/Wwd2XERFy9dGqs3Dn+RZzHWMgRyEoUZ7
 bnn11kQd7DK/YpGuT9qy5WJRSCuwg+lO
 =c01U